Documentation
¶
Index ¶
Constants ¶
View Source
const RevisionCurrent = -1
RevisionCurrent is current sync revision
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Action string
Key string
Data map[string]interface{}
Revision int64
// Err is used only by Sync.WatchContext()
Err error
}
Event is a struct for Watch response
type Node ¶
Node is a struct for Fetch response
type Sync ¶
type Sync interface {
HasLock(path string) bool
Lock(path string, block bool) (notifyLost chan struct{}, err error)
Unlock(path string) error
Fetch(path string) (*Node, error)
Update(path, json string) error
Delete(path string, prefix bool) error
// Watch monitors changes on path and emits Events to responseChan.
// Close stopChan to cancel.
// You can specify the revision to start watching,
// give RevisionCurrent when you want to start from the current revision.
// Returns an error when gets any error including connection failures.
Watch(path string, responseChan chan *Event, stopChan chan bool, revision int64) error
//WatchContext keep watch update under the path until context is canceled.
WatchContext(ctx context.Context, path string, revision int64) <-chan *Event
GetProcessID() string
Close()
}
Sync is a interface for sync servers
Source Files
¶
- sync.go
Click to show internal directories.
Click to hide internal directories.