topo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SpermwhaleDir = "/spermwhale"

Variables

This section is empty.

Functions

func ClusterDir

func ClusterDir(clusterName string) string

func GroupDir

func GroupDir(clusterName string) string

func GroupPath

func GroupPath(clusterName string, gid int) string

func LockPath

func LockPath(clusterName string) string

func OraclePath

func OraclePath(clusterName string) string

func TimestampPath

func TimestampPath(clusterName string) string

Types

type Cluster

type Cluster struct {
	GroupNumber int `json:"group_number"`
}

type Group

type Group struct {
	Id         int    `json:"id"`
	ServerAddr string `json:"server_addr"`
}

func (*Group) Encode

func (g *Group) Encode() []byte

type Oracle

type Oracle struct {
	ServerAddr string `json:"server_addr"`
}

func (*Oracle) Encode

func (o *Oracle) Encode() []byte

type Store

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

func NewStore

func NewStore(client client.Client, clusterName string) *Store

func (*Store) Acquire

func (s *Store) Acquire() error

func (*Store) Client

func (s *Store) Client() client.Client

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteGroup

func (s *Store) DeleteGroup(gid int) error

func (*Store) DeleteTimestamp

func (s *Store) DeleteTimestamp() error

func (*Store) GetLocalIP

func (s *Store) GetLocalIP() (string, error)

func (*Store) GroupDir

func (s *Store) GroupDir() string

func (*Store) GroupPath

func (s *Store) GroupPath(gid int) string

func (*Store) ListGroup

func (s *Store) ListGroup() (map[int]*Group, error)

func (*Store) LoadGroup

func (s *Store) LoadGroup(gid int, must bool) (*Group, error)

func (*Store) LoadOracle

func (s *Store) LoadOracle() (*Oracle, error)

func (*Store) LoadTimestamp

func (s *Store) LoadTimestamp() (uint64, error)

func (*Store) Lock

func (s *Store) Lock() (err error)

func (*Store) LockPath

func (s *Store) LockPath() string

func (*Store) OraclePath

func (s *Store) OraclePath() string

func (*Store) TimestampPath

func (s *Store) TimestampPath() string

func (*Store) Unlock

func (s *Store) Unlock() error

func (*Store) UpdateGroup

func (s *Store) UpdateGroup(g *Group) error

func (*Store) UpdateOracle

func (s *Store) UpdateOracle(o *Oracle) error

func (*Store) UpdateTimestamp

func (s *Store) UpdateTimestamp(ts uint64) error

func (*Store) WithClusterLocked

func (s *Store) WithClusterLocked(f func() error) error

Directories

Path Synopsis
fs

Jump to

Keyboard shortcuts

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