package raftNode2

//uidData id生成器的数据结构
type uidData struct {
	uid       int64  //自增id
	preDomain int64  //前置域
	name      string //关键字
}

type StorageInterface interface {
	IsLeader() bool
	NewUUID(name string, id, preDomain int64) (int64, error)
	SessionLock(domain, sessionID string, maxActive, expire int64) (bool, error)
	SessionUnLock(domain, sessionID string) error
	Set(key string, value interface{}, expire ...int64) error
	MSet(tree, key string, value interface{}, expire ...int64) error
	Get(key string) (interface{}, int64)
	MGet(tree, key string) (interface{}, int64)
	MDel(tree, key string) error
	Del(key string) error
	Task(runTime int, action func())
	RegisterLeaderEventHandler(handler func(isLeader bool) error)
	RegisterUUidLoadHandler(loadHandler func(tree, key string, value interface{}, preDomain string))
	RegisterLockLoadHandler(loadHandler func(tree, key string, value interface{}, preDomain string))
	RegisterLoadHandler(loadHandler func(tree, key string, value interface{}, expire int64))
}

type LogerInterface interface {
	Trace(args ...interface{})
	Tracef(template string, args ...interface{})
	Debug(args ...interface{})
	Debugf(template string, args ...interface{})
	Info(args ...interface{})
	Infof(template string, args ...interface{})
	Warn(args ...interface{})
	Warnf(template string, args ...interface{})
	Error(args ...interface{})
	Errorf(template string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(template string, args ...interface{})
	Panic(args ...interface{})
	Panicf(template string, args ...interface{})
}
