Esempio n. 1
0
func NewBucket(database data.Database, name string) (Bucket, error) {
	b, err := database.Bucket([]byte(name))
	if err != nil {
		return nil, err
	}

	return &bucket{b}, nil
}
Esempio n. 2
0
func NewRiver(database data.Database, cutoff time.Duration) (River, error) {
	b, err := database.Bucket(riverBucketName)
	if err != nil {
		return nil, err
	}

	riv := &river{b, cutoff}

	go func() {
		for _ = range time.Tick(cutoff) {
			log.Println("truncating feed data")
			riv.truncate()
			log.Println("done truncating")
		}
	}()

	return riv, nil
}