Esempio n. 1
0
func (start) Start(dbDir string, cacheSize int) circuit.XPerm {
	srv, err := New(dbDir, cacheSize)
	if err != nil {
		panic(err)
	}
	circuit.Listen("vena", srv)
	circuit.Daemonize(func() { <-(chan int)(nil) })
	return circuit.PermRef(srv)
}
Esempio n. 2
0
// StartReducer.Start is a worker function that initializes a new Reducer and
// returns a cross-runtime pointer to it
func (StartReducer) Start() circuit.X {
	r := &Reducer{}                      // Create a new reducer object
	r.m = make(map[int64]*Post)          // Create the map holding the posts, indexed by ID
	circuit.Listen("reducer-service", r) // Register Reducer as public service that can be accessed on this worker
	circuit.Daemonize(func() {
		r.maintainTop() // Start a background goroutine that maintains the top ten posts on this reducer
	})
	return circuit.Ref(r) // Make the pointer to the Reducer object exportable and return it
}
Esempio n. 3
0
func (StartReducer) Start() circuit.X {
	r := &Reducer{}
	r.m = make(map[int64]*SlidingPost)
	r.rank = llrb.New(SlidingPostLess)
	circuit.Listen("reducer-service", r)
	circuit.Daemonize(func() {
		r.maintainTop()
	})
	return circuit.Ref(r)
}