예제 #1
0
func NewKVStore(logger *util.Logger) *KVStore {
	inst := &KVStore{
		Logger:  logger,
		store:   bt.NewTree(),
		expiry:  map[int64][]ch.Key{},
		running: false,
	}
	return inst
}
예제 #2
0
// 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
}