Documentation ¶
Overview ¶
Cassandra backend for GroupIDX. For expiring entries, Cassandra's automatic expiration feature ('USING TTL xxx' in CQL) is used, so it's super efficient.
Index ¶
- Constants
- Variables
- func Initialize(session *gocql.Session)
- func InitializeN2Layer(session *gocql.Session)
- func MaintainanceCtrTable(session *gocql.Session)
- type Granularity
- type N2LayerGroupDB
- func (N2LayerGroupDB) ArticleGroupGet(group []byte, num int64, head, body bool, id_buf []byte) ([]byte, *newspolyglot.ArticleObject)
- func (g *N2LayerGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))
- func (g *N2LayerGroupDB) ArticleGroupMove(group []byte, i int64, backward bool, id_buf []byte) (ni int64, id []byte, ok bool)
- func (g *N2LayerGroupDB) ArticleGroupOverview(group []byte, first, last int64, ...)
- func (g *N2LayerGroupDB) ArticleGroupStat(group []byte, num int64, id_buf []byte) ([]byte, bool)
- func (g *N2LayerGroupDB) GroupRealtimeQuery(group []byte) (number int64, low int64, high int64, ok bool)
- func (g *N2LayerGroupDB) StoreArticleInfos(groups [][]byte, nums []int64, exp uint64, ov *newspolyglot.ArticleOverview) (err error)
- func (g *N2LayerGroupDB) Validate()
- type SimpleGroupDB
- func (SimpleGroupDB) ArticleGroupGet(group []byte, num int64, head, body bool, id_buf []byte) ([]byte, *newspolyglot.ArticleObject)
- func (g *SimpleGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))
- func (g *SimpleGroupDB) ArticleGroupMove(group []byte, i int64, backward bool, id_buf []byte) (ni int64, id []byte, ok bool)
- func (g *SimpleGroupDB) ArticleGroupOverview(group []byte, first, last int64, ...)
- func (g *SimpleGroupDB) ArticleGroupStat(group []byte, num int64, id_buf []byte) ([]byte, bool)
- func (g *SimpleGroupDB) GroupRealtimeQuery(group []byte) (number int64, low int64, high int64, ok bool)
- func (g *SimpleGroupDB) StoreArticleInfos(groups [][]byte, nums []int64, exp uint64, ov *newspolyglot.ArticleOverview) (err error)
- func (g *SimpleGroupDB) Validate()
Constants ¶
const DAY = 60 * 60 * 24
24 Hours in seconds
Variables ¶
var ENoSuchGroup = errors.New("Missing Group")
var EUnimplemented = errors.New("EUnimplemented")
Functions ¶
func Initialize ¶
func InitializeN2Layer ¶
func MaintainanceCtrTable ¶
Maintainance routine for the Countertable 'agrpcnt'.
Types ¶
type Granularity ¶
type Granularity struct { // expiry alignment in seconds, defaults to 1 second. EPA uint64 // expiry round up. Round up if true, round down if false. EPRU bool // counter table alignment in seconds, defaults to 60*60*24 (24 hours) CTA uint64 // counter table round up. Round up if true, round down if false. // if CTA is 0, this flag is ignored and the counter-table value is rounded up. CTRU bool }
type N2LayerGroupDB ¶
type N2LayerGroupDB struct { Granularity Session *gocql.Session OnAssign gocql.Consistency OnIncrement gocql.Consistency // contains filtered or unexported fields }
A two-level Datastore that, instead of storing an entire Newsgroup in a partition divides it up into blocks of up to approx. 16 million entries. A seperate hash partition is created (in a seperate table) to keept track of those partitions, especially to allow ordered traversion of all partitions in the korrect order.
func (N2LayerGroupDB) ArticleGroupGet ¶
func (N2LayerGroupDB) ArticleGroupGet(group []byte, num int64, head, body bool, id_buf []byte) ([]byte, *newspolyglot.ArticleObject)
Unimplemented!
func (*N2LayerGroupDB) ArticleGroupList ¶
func (g *N2LayerGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))
Efficient traversal of a newsgroup.
func (*N2LayerGroupDB) ArticleGroupMove ¶
func (*N2LayerGroupDB) ArticleGroupOverview ¶
func (g *N2LayerGroupDB) ArticleGroupOverview(group []byte, first, last int64, targ func(int64, *newspolyglot.ArticleOverview))
func (*N2LayerGroupDB) ArticleGroupStat ¶
func (*N2LayerGroupDB) GroupRealtimeQuery ¶
func (*N2LayerGroupDB) StoreArticleInfos ¶
func (g *N2LayerGroupDB) StoreArticleInfos(groups [][]byte, nums []int64, exp uint64, ov *newspolyglot.ArticleOverview) (err error)
func (*N2LayerGroupDB) Validate ¶
func (g *N2LayerGroupDB) Validate()
Validates the Object arguments such as OnIncrement.
Should be called before the object is being used, for reliability.
type SimpleGroupDB ¶
type SimpleGroupDB struct { Granularity Session *gocql.Session OnAssign gocql.Consistency OnIncrement gocql.Consistency // contains filtered or unexported fields }
A simple Datastore using one partition key per newsgroup. It has the advantage, that it is very simple, and thus has low overhead, and few moving parts. But it has the disadvantage, that huge newsgroup may cause a skew distribution across partitions.
func (SimpleGroupDB) ArticleGroupGet ¶
func (SimpleGroupDB) ArticleGroupGet(group []byte, num int64, head, body bool, id_buf []byte) ([]byte, *newspolyglot.ArticleObject)
Unimplemented!
func (*SimpleGroupDB) ArticleGroupList ¶
func (g *SimpleGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))
Efficient traversal of a newsgroup.
func (*SimpleGroupDB) ArticleGroupMove ¶
func (*SimpleGroupDB) ArticleGroupOverview ¶
func (g *SimpleGroupDB) ArticleGroupOverview(group []byte, first, last int64, targ func(int64, *newspolyglot.ArticleOverview))
func (*SimpleGroupDB) ArticleGroupStat ¶
func (*SimpleGroupDB) GroupRealtimeQuery ¶
func (*SimpleGroupDB) StoreArticleInfos ¶
func (g *SimpleGroupDB) StoreArticleInfos(groups [][]byte, nums []int64, exp uint64, ov *newspolyglot.ArticleOverview) (err error)
func (*SimpleGroupDB) Validate ¶
func (g *SimpleGroupDB) Validate()
Validates the Object arguments such as OnIncrement.
Should be called before the object is being used, for reliability.