Documentation ¶
Overview ¶
*
- @Author: hiram
- @Date: 2021/3/18 13:40
*
- @Author: hiram
- @Date: 2021/3/18 13:41
*
- @Author: hiram
- @Date: 2021/3/18 13:41
*
- @Author: hiram
- @Date: 2021/3/18 13:42
*
- @Author: hiram
- @Date: 2021/3/18 13:43
*
- @Author: hiram
- @Date: 2021/3/18 13:43
*
- @Author: hiram
- @Date: 2021/3/18 13:44
*
- @Author: hiram
- @Date: 2021/3/18 13:44
Index ¶
- Constants
- Variables
- func Hash(s string) int
- func HostName() string
- func ObjectToString(object interface{}) string
- func Pid() string
- func RunHandle()
- func RunWatch()
- func Stamp() int64
- func StringToObject(str string, object interface{})
- type Client
- type Etcd
- func (e *Etcd) Atomic(writes KVs, deletes Ks) *v3.TxnResponse
- func (e *Etcd) DeleteItem(key string)
- func (e *Etcd) ReadItem(key string) KV
- func (e *Etcd) ReadItems(key string) KVs
- func (e *Etcd) SpinLock(name string, ttl int64) func() bool
- func (e *Etcd) WatchPrefix(prefix string, startRevision int64, eventCh chan Events, stopCh chan struct{})
- func (e *Etcd) WriteItem(key string, value string)
- type Event
- type Event_EventType
- type Events
- type Handler
- type KV
- type KVs
- type Ks
- type Q
- type Queue
- type QueueValue
- type Schedule
- type Scheduler
- type Set
- type SyncHandle
- type Watch
- type WatchScheduleGroup
- type Watcher
Constants ¶
View Source
const ( ResourcePrefix = "/resources/" // custom resource operation, generate events WatcherPrefix = "/watchers/" // global single watcher, watch events QueuePrefix = "/queues/" // central queue, storage events HandlerPrefix = "/handlers/" // handler's own events to handle LockPrefix = "/locks" // handler's registered lock )
View Source
const ( WatchSleep = time.Millisecond * 100 ScheduleSleep = time.Millisecond * 100 HandlerSleep = time.Millisecond * 100 MonitorSleep = time.Second * 2 ErrorSleep = time.Second * 5 CtxTimeout = time.Second * 10 )
View Source
const ( MaxCallSendMsgSize = 512 * 1024 * 1024 MaxCallRecvMsgSize = 512 * 1024 * 1024 MaxTxnOps = 32768 )
./etcd.exe --max-txn-ops="32768" --max-request-bytes="536870912"
Variables ¶
View Source
var Exists = struct{}{}
Functions ¶
func ObjectToString ¶
func ObjectToString(object interface{}) string
func StringToObject ¶
func StringToObject(str string, object interface{})
Types ¶
type Client ¶
type Client interface { ReadItem(string) KV ReadItems(string) KVs WriteItem(string, string) DeleteItem(string) Atomic(writes KVs, deletes Ks) *v3.TxnResponse WatchPrefix(prefix string, startRevision int64, eventCh chan Events, stopCh chan struct{}) SpinLock(name string, ttl int64) func() bool // A distributed lock, return func for lockAliveCheck }
type Etcd ¶
type Etcd struct { MaxTxnOps int // contains filtered or unexported fields }
func (*Etcd) DeleteItem ¶
func (*Etcd) WatchPrefix ¶
type Event_EventType ¶
type Event_EventType int32
const ( PUT Event_EventType = 0 DELETE Event_EventType = 1 )
type QueueValue ¶
type QueueValue struct { EventType Event_EventType Value interface{} }
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func (*Scheduler) Distribute ¶
func (*Scheduler) InitPrevAliveHandlers ¶
func (*Scheduler) Redistribute ¶
type SyncHandle ¶
type Watch ¶
type Watch interface { WatchPrefix(stopCh chan struct{}) // contains filtered or unexported methods }
type WatchScheduleGroup ¶
type WatchScheduleGroup struct {
// contains filtered or unexported fields
}
func NewWatchScheduleGroup ¶
func NewWatchScheduleGroup(resource string, etcd *Etcd) WatchScheduleGroup
func (WatchScheduleGroup) Run ¶
func (wsg WatchScheduleGroup) Run()
Click to show internal directories.
Click to hide internal directories.