Help us shape the future of Go! Take the 2026 Go Developer Survey

etcdv3

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sync

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

Sync is struct for etcd based sync

func NewSync

func NewSync(etcdServers []string, timeout time.Duration) (*Sync, error)

NewSync initialize new etcd sync

func (*Sync) Close

func (s *Sync) Close()

Close closes etcd client

func (*Sync) Delete

func (s *Sync) Delete(key string, prefix bool) error

Delete sync update sync

func (*Sync) Fetch

func (s *Sync) Fetch(key string) (*sync.Node, error)

Fetch data from sync

func (*Sync) GetProcessID

func (s *Sync) GetProcessID() string

GetProcessID returns processID

func (*Sync) HasLock

func (s *Sync) HasLock(path string) bool

HasLock checks current process owns lock or not

func (*Sync) Lock

func (s *Sync) Lock(path string, block bool) (chan struct{}, error)

Lock locks resources on sync This call blocks until you can get lock

func (*Sync) Unlock

func (s *Sync) Unlock(path string) error

Unlock path

func (*Sync) Update

func (s *Sync) Update(key, jsonString string) error

Update sync update sync When jsonString is empty, this method do nothing because etcd v3 doesn't support directories.

func (*Sync) Watch

func (s *Sync) Watch(path string, responseChan chan *sync.Event, stopChan chan bool, revision int64) error

Watch keep watch update under the path

func (*Sync) WatchContext

func (s *Sync) WatchContext(ctx context.Context, path string, revision int64) <-chan *sync.Event

WatchContext keep watch update under the path until context is canceled

Source Files

  • etcd.go
  • log.go

Jump to

Keyboard shortcuts

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