app

package
v0.0.0-...-59e6379 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionNone = 1 << iota
	ActionAdd
	ActionDel
)

Variables

This section is empty.

Functions

func NewRaftStorage

func NewRaftStorage(id uint64, peerIds []uint)

Types

type ICloud

type ICloud interface {
	Save(path string) error
	Load(path string) error

	Set(key string, value interface{}) error
	Get(key string) (interface{}, error)
	Delete(key string) error

	Info() ([]*MemberInfo, error)

	Benchmark(n int) error
}

type MemberInfo

type MemberInfo struct {
	Name   string
	Addr   string
	Status int
}

type Storage

type Storage struct {
	Name      string
	LocalNode func() *memberlist.Node
	Members   func() ([]*MemberInfo, error)
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(name string, port int, join string) *Storage

func (*Storage) Benchmark

func (s *Storage) Benchmark(n int) error

func (*Storage) Delete

func (s *Storage) Delete(key string) error

func (*Storage) Get

func (s *Storage) Get(key string) (interface{}, error)

func (*Storage) Info

func (s *Storage) Info() ([]*MemberInfo, error)

func (*Storage) Load

func (s *Storage) Load(path string) (err error)

Load: 启动时加载

func (*Storage) RegisterMember

func (s *Storage) RegisterMember(name string, port int, join string)

func (*Storage) Save

func (s *Storage) Save(path string) (err error)

Save: 退出时保存

func (*Storage) Set

func (s *Storage) Set(key string, value interface{}) error

func (*Storage) UnpackNotify

func (s *Storage) UnpackNotify(b []byte)

UnpackNotify: 二次解析,发送到ch

Jump to

Keyboard shortcuts

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