Beispiel #1
0
func NewKVStore(logger *util.Logger) *KVStore {
	inst := &KVStore{
		Logger:  logger,
		store:   bt.NewTree(),
		expiry:  map[int64][]ch.Key{},
		running: false,
	}
	return inst
}
// Return a pointer to a new ServerNode with the specified host address.
func NewServerNode(hostAddr string) *ServerNode {
	node := &ServerNode{
		NetworkNodes: map[Key]*ServerNetworkNode{},
		Network:      bt.NewTree(),
	}
	node.ID = NewRandomKey()
	node.HostAddr = hostAddr
	node.Init()
	return node
}