timers

package
v0.0.0-...-8836d2b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Resolution = int64(7) // seconds

)

Constants

Variables

This section is empty.

Functions

func Create

func Create(uid string, partn int, connstr string, bucket string) error

func ForceSpanSync

func ForceSpanSync()

func MustRun

func MustRun(fn func() error) error

Only returns TimeOutError

func Pool

func Pool(connstr string) *kvPool

func PoolStats

func PoolStats() map[string]uint64

func SetRebalancer

func SetRebalancer(r rebalancer)

func SetTestAuth

func SetTestAuth(user, pass string)

func SetTimeout

func SetTimeout(tmout time.Duration)

Types

type AlarmRecord

type AlarmRecord struct {
	AlarmDue   int64  `json:"due"`
	ContextRef string `json:"cxr"`
}

type ContextRecord

type ContextRecord struct {
	Context  interface{} `json:"ctx"`
	AlarmRef string      `json:"alr"`
}

func (*ContextRecord) String

func (r *ContextRecord) String() string

type DeleteToken

type DeleteToken struct {
	Bucket     string `json:"bucket"`
	AlarmKey   string `json:"alarm_key"`
	AlarmCas   uint64 `json:"alarm_cas"`
	ContextKey string `json:"context_key"`
	ContextCas uint64 `json:"context_cas"`
}

This can be used to delete a timer from outside this project, as follows:

  1. Delete context_key from bucket with context_cas, ignore any absent/mismatch error
  2. Delete alarm_key from bucket with alarm_cas, log any absent/mismatch error

type Span

type Span struct {
	Start int64 `json:"sta"`
	Stop  int64 `json:"stp"`
}

type TimerEntry

type TimerEntry struct {
	AlarmRecord
	ContextRecord
	// contains filtered or unexported fields
}

type TimerIter

type TimerIter struct {
	// contains filtered or unexported fields
}

func (*TimerIter) ScanNext

func (r *TimerIter) ScanNext() (*TimerEntry, error)

type TimerStore

type TimerStore struct {
	// contains filtered or unexported fields
}

func Fetch

func Fetch(uid string, partn int) (store *TimerStore, found bool)

func (*TimerStore) Cancel

func (r *TimerStore) Cancel(ref string) error

func (*TimerStore) Delete

func (r *TimerStore) Delete(entry *TimerEntry) error

func (*TimerStore) Free

func (r *TimerStore) Free()

func (*TimerStore) GetToken

func (r *TimerStore) GetToken(e *TimerEntry) *DeleteToken

func (*TimerStore) Partition

func (r *TimerStore) Partition() int

func (*TimerStore) ScanDue

func (r *TimerStore) ScanDue() *TimerIter

func (*TimerStore) Set

func (r *TimerStore) Set(due int64, ref string, context interface{}) error

func (*TimerStore) Stats

func (r *TimerStore) Stats() map[string]uint64

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL