Documentation ¶
Index ¶
- type ClientImpl
- type ClientStateImpl
- func (s *ClientStateImpl) Add(token string, version uint64, status enum.Policy) bool
- func (s *ClientStateImpl) Delete(token string)
- func (s *ClientStateImpl) GetStatus(token string) enum.Policy
- func (s *ClientStateImpl) GetVersion(token string) uint64
- func (s *ClientStateImpl) Query(token string) bool
- type StorageImpl
- type SyncRPCServer
- type UserClientImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
func NewClientImpl ¶
func NewClientImpl(name string, clientHost string, clientPort string, serverHost string, c pb.MaintainerClient) ClientImpl
NewClientImpl is a tool to get a client
func (*ClientImpl) ChangeStatus ¶
func (c *ClientImpl) ChangeStatus(ctx context.Context, token string) error
ChangeStatus will change the ownership of key
func (*ClientImpl) Query ¶
Query first query from local, if it does not exist, it will sync from others
func (*ClientImpl) Set ¶
func (c *ClientImpl) Set(token string, value string)
type ClientStateImpl ¶
ClientStateImpl maintains state which stores keys you hold
func NewClientStateImpl ¶
func NewClientStateImpl() *ClientStateImpl
NewClientStateImpl is a support function
func (*ClientStateImpl) GetStatus ¶
func (s *ClientStateImpl) GetStatus(token string) enum.Policy
GetStatus by token return Policy
func (*ClientStateImpl) GetVersion ¶
func (s *ClientStateImpl) GetVersion(token string) uint64
GetVersion by token
type StorageImpl ¶
StorageImpl is an type of storage using simple map and Mutex
func NewStorageImpl ¶
func NewStorageImpl() *StorageImpl
func (*StorageImpl) Delete ¶
func (s *StorageImpl) Delete(token string) error
Delete will delete key in map
type SyncRPCServer ¶
type SyncRPCServer struct {
// contains filtered or unexported fields
}
SyncRPCServer implement method
func (*SyncRPCServer) Sync ¶
func (s *SyncRPCServer) Sync(ctx context.Context, in *pb.SyncRequest) (*pb.SyncReply, error)
Sync data to other client
type UserClientImpl ¶
type UserClientImpl struct {
// contains filtered or unexported fields
}
UserClientImpl use context and RPC to implement UserClient
func NewUserClientImpl ¶
func NewUserClientImpl(name string, clientHost string, clientPort string, serverHost string, c pb.MaintainerClient) *UserClientImpl
NewUserClientImpl is an support function for other package
func (*UserClientImpl) Close ¶
func (c *UserClientImpl) Close()
Close use cancel function and wait all routine over
func (*UserClientImpl) Get ¶
func (c *UserClientImpl) Get(token string) (string, error)
Get value by key
func (*UserClientImpl) Set ¶
func (c *UserClientImpl) Set(token string, value string) error
Set value
func (*UserClientImpl) Start ¶
func (c *UserClientImpl) Start() error
Start will init context and start statusClient