Exemplo n.º 1
0
func NewApiServer(fs FileService, nodeId int) *apiServer {
	s := new(apiServer)
	s.fs = fs
	// TODO: Get epoch and node id from some config
	log.Println("NodeID: ", nodeId)
	s.fl = flother.NewFlother(time.Time{}, uint64(nodeId))
	s.blocksize = int64(1024 * 64) // Default Block Size (64K)
	return s
}
Exemplo n.º 2
0
func NewApiServer(fs FileService, nodeId int, comms *StoreComms) *apiServer {
	s := new(apiServer)
	s.fs = fs
	s.comms = comms
	s.validIPs = make(map[string]map[string]bool)
	log.Println("NodeID: ", nodeId)
	s.fl = flother.NewFlother(time.Time{}, uint64(nodeId))
	s.blocksize = int64(1024 * 64) // Default Block Size (64K)
	s.updateChan = make(chan *UpdateItem, 1000)
	updates := newUpdatinator(s.updateChan, fs)
	go updates.run()
	return s
}