Documentation ¶
Index ¶
- Constants
- Variables
- func NewLocker(session *concurrency.Session, pfx string) *lockerMutex
- type Recode
- type StorageEtcd
- func (se *StorageEtcd) AddFile(domain, file string, data map[string]map[string]string, note string) error
- func (se *StorageEtcd) DelDomain(domain string, note string) error
- func (se *StorageEtcd) DelFile(domain, file, note string) error
- func (se *StorageEtcd) DelKeeperAddr(domain, nodeID, preAddr string) error
- func (se *StorageEtcd) DelKey(domain, file, section, key, note string) error
- func (se *StorageEtcd) GetAliveKeeperNodes(withLock bool) (map[int64]string, error)
- func (se *StorageEtcd) GetCurrentVersion(domain string, withLock bool) (int64, error)
- func (se *StorageEtcd) GetDomain(domain string, withLock bool) (map[string]map[string]map[string]string, error)
- func (se *StorageEtcd) GetDomainNames(withLock bool) ([]string, error)
- func (se *StorageEtcd) GetHistoryVersions(domain string, num, offset int64, withLock bool) (interface{}, error)
- func (se *StorageEtcd) GetKeeperAddr(domain, nodeID string, withLock bool) (string, error)
- func (se *StorageEtcd) GetKeeperAddrs(domain string, withLock bool) ([]string, error)
- func (se *StorageEtcd) GetKey(domain, file, section, key string, withLock bool) (string, error)
- func (se *StorageEtcd) GetMaxVersion(domain string, withLock bool) (int64, error)
- func (se *StorageEtcd) KeepAlive(id int64, addr string)
- func (se *StorageEtcd) Rollback(domain string, version int64, note string) error
- func (se *StorageEtcd) Run()
- func (se *StorageEtcd) SetCurrentVersion(domain string, version int64) error
- func (se *StorageEtcd) SetDomain(domain string, data map[string]map[string]map[string]string, note string) error
- func (se *StorageEtcd) SetKeeperAddr(domain, nodeID, addr string) error
- func (se *StorageEtcd) SetKey(domain, file, section, key, value, note string) error
- func (se *StorageEtcd) Watch(mode operate.EventModeType, storageEventChan chan<- operate.Event)
Constants ¶
View Source
const ( PathSeparator = string(filepath.Separator) GokeeperRootPath = "gokeeper" ConfRootPath = "conf" VersionRootPath = "version" AllVersionPath = "all" CurrentVersionPath = "current" AddrRootPath = "addr" //租约path LeaseRootPath = "lease" NodeLeasePath = "node" LockRootPath = "lock" CronPath = "cron" )
Variables ¶
View Source
var (
ErrKeyNotExist = errors.New("key not exist")
)
Functions ¶
func NewLocker ¶
func NewLocker(session *concurrency.Session, pfx string) *lockerMutex
Types ¶
type StorageEtcd ¶
func NewEtcdStorage ¶
func (*StorageEtcd) AddFile ¶
func (se *StorageEtcd) AddFile(domain, file string, data map[string]map[string]string, note string) error
如果该文件已经存在,则更新
func (*StorageEtcd) DelDomain ¶
func (se *StorageEtcd) DelDomain(domain string, note string) error
TODO:是否需要同时删除version
func (*StorageEtcd) DelFile ¶
func (se *StorageEtcd) DelFile(domain, file, note string) error
func (*StorageEtcd) DelKeeperAddr ¶
func (se *StorageEtcd) DelKeeperAddr(domain, nodeID, preAddr string) error
func (*StorageEtcd) DelKey ¶
func (se *StorageEtcd) DelKey(domain, file, section, key, note string) error
func (*StorageEtcd) GetAliveKeeperNodes ¶
func (se *StorageEtcd) GetAliveKeeperNodes(withLock bool) (map[int64]string, error)
func (*StorageEtcd) GetCurrentVersion ¶
func (se *StorageEtcd) GetCurrentVersion(domain string, withLock bool) (int64, error)
func (*StorageEtcd) GetDomainNames ¶
func (se *StorageEtcd) GetDomainNames(withLock bool) ([]string, error)
func (*StorageEtcd) GetHistoryVersions ¶
func (se *StorageEtcd) GetHistoryVersions(domain string, num, offset int64, withLock bool) (interface{}, error)
func (*StorageEtcd) GetKeeperAddr ¶
func (se *StorageEtcd) GetKeeperAddr(domain, nodeID string, withLock bool) (string, error)
func (*StorageEtcd) GetKeeperAddrs ¶
func (se *StorageEtcd) GetKeeperAddrs(domain string, withLock bool) ([]string, error)
func (*StorageEtcd) GetKey ¶
func (se *StorageEtcd) GetKey(domain, file, section, key string, withLock bool) (string, error)
func (*StorageEtcd) GetMaxVersion ¶
func (se *StorageEtcd) GetMaxVersion(domain string, withLock bool) (int64, error)
func (*StorageEtcd) KeepAlive ¶
func (se *StorageEtcd) KeepAlive(id int64, addr string)
keepalive需要消费chan,如果不及时消费,keepalive会500ms请求一次心跳操作,导致qps上升 如果keepalive返回的chan被关闭,需要重新申请leaseID,然后再进行重新keepalive。(注意,超过续约时间,leaseID会失效)
func (*StorageEtcd) Rollback ¶
func (se *StorageEtcd) Rollback(domain string, version int64, note string) error
func (*StorageEtcd) Run ¶
func (se *StorageEtcd) Run()
func (*StorageEtcd) SetCurrentVersion ¶
func (se *StorageEtcd) SetCurrentVersion(domain string, version int64) error
TODO
func (*StorageEtcd) SetKeeperAddr ¶
func (se *StorageEtcd) SetKeeperAddr(domain, nodeID, addr string) error
func (*StorageEtcd) SetKey ¶
func (se *StorageEtcd) SetKey(domain, file, section, key, value, note string) error
func (*StorageEtcd) Watch ¶
func (se *StorageEtcd) Watch(mode operate.EventModeType, storageEventChan chan<- operate.Event)
Click to show internal directories.
Click to hide internal directories.