go-micro: github.com/micro/go-micro/sync Index | Files | Directories

package sync

import "github.com/micro/go-micro/sync"

Package sync is a distributed synchronization framework

Index

Package Files

cron.go map.go options.go sync.go

type Cron Uses

type Cron interface {
    Schedule(task.Schedule, task.Command) error
}

Cron is a distributed scheduler using leader election and distributed task runners. It uses the leader and task interfaces.

func NewCron Uses

func NewCron(opts ...Option) Cron

type Map Uses

type Map interface {
    // Read value with given key
    Read(key, val interface{}) error
    // Write value with given key
    Write(key, val interface{}) error
    // Delete value with given key
    Delete(key interface{}) error
    // Iterate over all key/vals. Value changes are saved
    Iterate(func(key, val interface{}) error) error
}

Map provides synchronized access to key-value storage. It uses the store interface and lock interface to provide a consistent storage mechanism.

func NewMap Uses

func NewMap(opts ...Option) Map

type Option Uses

type Option func(o *Options)

func WithLeader Uses

func WithLeader(l leader.Leader) Option

WithLeader sets the leader election implementation opton

func WithLock Uses

func WithLock(l lock.Lock) Option

WithLock sets the locking implementation option

func WithStore Uses

func WithStore(s store.Store) Option

WithStore sets the store implementation option

func WithTime Uses

func WithTime(t time.Time) Option

WithTime sets the time implementation option

type Options Uses

type Options struct {
    Leader leader.Leader
    Lock   lock.Lock
    Store  store.Store
    Task   task.Task
    Time   time.Time
}

Directories

PathSynopsis
eventPackage event provides a distributed log interface
leaderPackage leader provides leader election
leader/etcd
lockPackage lock provides distributed locking
lock/etcdPackage etcd is an etcd implementation of lock
lock/httpPackage http adds a http lock implementation
lock/http/serverPackage server implements the sync http server
lock/memoryPackage memory provides a sync.Mutex implementation of the lock for local use
taskPackage task provides an interface for distributed jobs
task/brokerPackage broker provides a distributed task manager built on the micro broker
task/localPackage local provides a local task runner
timePackage time provides clock synchronization
time/localPackage local provides a local clock
time/ntpPackage ntp provides ntp synchronized time

Package sync imports 17 packages (graph). Updated 2020-02-08. Refresh now. Tools for package owners.