Documentation
¶
Index ¶
- Constants
- type Config
- type EtcdWrap
- func (w *EtcdWrap) AtomAdd(key string, value int) (int, error)
- func (w *EtcdWrap) Delete(key string) (*client.Response, error)
- func (w *EtcdWrap) Get(key string) (*client.Response, error)
- func (w *EtcdWrap) GetNCreate(key string, createValue int) (*client.Response, error)
- func (w *EtcdWrap) GetVersion() (*version.Versions, error)
- func (w *EtcdWrap) IsKeyExist(err error) bool
- func (w *EtcdWrap) IsKeyNotFound(err error) bool
- func (w *EtcdWrap) Set(key string, value string, opts *client.SetOptions) (*client.Response, error)
- type EtcdWrapConfig
- type UUIDServer
Constants ¶
View Source
const ( // StartOfContainerID the first ID that the container starts to assgin. StartOfContainerID = 10 // StartOfServerID the first ID that the server starts to assgin. StartOfServerID = 10 // StartOfSequence the first ID that the sequence starts to assgin. StartOfSequence = 1 // MaxOfSequence the maximum of the sequence. MaxOfSequence = 1 << 31 // KeyOfMaxContainerID holds the key for the maximum container ID. KeyOfMaxContainerID = "max_containerid" // KeyOfMaxServiceID holds the key for the maximum service ID. KeyOfMaxServiceID = "max_serviceid" // KeyOfContainerDir the directory where the key value is saved. KeyOfContainerDir = "container" // KeyOfServiceDir the directory where the key value is saved. KeyOfServiceDir = "service" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Endpoints defines a set of URLs Endpoints []string // Username specifies the user credential to add as an authorization header UserName string // Password is the password for the specified user to add as an authorization header // to the request. Password string // ListenAddress the server listens for local address. ListenAddress string // Prefix path prefix saved in the etcd. Prefix string }
Config the config used to create the server.
type EtcdWrap ¶
type EtcdWrap struct {
// contains filtered or unexported fields
}
EtcdWrap Encapsulation of etcd
func NewEtcdWrap ¶
func NewEtcdWrap(cfg *EtcdWrapConfig) (w *EtcdWrap, err error)
NewEtcdWrap create a new etcd wrap.
func (*EtcdWrap) GetNCreate ¶
GetNCreate retrieves a set of Nodes from etcd, created if not present.
func (*EtcdWrap) GetVersion ¶
GetVersion retrieves the current etcd server and cluster version.
func (*EtcdWrap) IsKeyExist ¶
IsKeyExist returns true if the error code is ErrorCodeNodeExist.
func (*EtcdWrap) IsKeyNotFound ¶
IsKeyNotFound returns true if the error code is ErrorCodeKeyNotFound.
type EtcdWrapConfig ¶
type EtcdWrapConfig struct { // Endpoints defines a set of URLs Endpoints []string // Username specifies the user credential to add as an authorization header UserName string // Password is the password for the specified user to add as an authorization header // to the request. Password string }
EtcdWrapConfig config struct
type UUIDServer ¶
type UUIDServer struct {
// contains filtered or unexported fields
}
UUIDServer UUID server.
func StartServer ¶
func StartServer(cfg *Config) (*UUIDServer, error)
StartServer create a server and run it.
func (*UUIDServer) Fetch ¶
func (s *UUIDServer) Fetch(ctx context.Context, in *api.FetchRequest) (*api.FetchReply, error)
Fetch get UUID range through the server.
func (*UUIDServer) ReassignContainerID ¶
func (s *UUIDServer) ReassignContainerID(containerName string) error
ReassignContainerID reassign an ID to the container.
Click to show internal directories.
Click to hide internal directories.