cassm

package
v0.0.0-...-060dca9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2018 License: MIT Imports: 4 Imported by: 0

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

View Source
const DAY = 60 * 60 * 24

24 Hours in seconds

Variables

View Source
var ENoSuchGroup = errors.New("Missing Group")
View Source
var EUnimplemented = errors.New("EUnimplemented")

Functions

func Initialize

func Initialize(session *gocql.Session)

func InitializeN2Layer

func InitializeN2Layer(session *gocql.Session)

func MaintainanceCtrTable

func MaintainanceCtrTable(session *gocql.Session)

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) ArticleGroupList

func (g *N2LayerGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))

Efficient traversal of a newsgroup.

func (*N2LayerGroupDB) ArticleGroupMove

func (g *N2LayerGroupDB) ArticleGroupMove(group []byte, i int64, backward bool, id_buf []byte) (ni int64, id []byte, ok bool)

func (*N2LayerGroupDB) ArticleGroupStat

func (g *N2LayerGroupDB) ArticleGroupStat(group []byte, num int64, id_buf []byte) ([]byte, bool)

func (*N2LayerGroupDB) AssignArticleToGroup

func (g *N2LayerGroupDB) AssignArticleToGroup(group []byte, num, exp uint64, id []byte) error

func (*N2LayerGroupDB) AssignArticleToGroups

func (g *N2LayerGroupDB) AssignArticleToGroups(groups [][]byte, nums []int64, exp uint64, id []byte) (err error)

func (N2LayerGroupDB) GroupHeadInsert

func (N2LayerGroupDB) GroupHeadInsert(groups [][]byte, buf []int64) ([]int64, error)

EUnimplemented

func (N2LayerGroupDB) GroupHeadRevert

func (N2LayerGroupDB) GroupHeadRevert(groups [][]byte, nums []int64) error

EUnimplemented

func (*N2LayerGroupDB) GroupRealtimeQuery

func (g *N2LayerGroupDB) GroupRealtimeQuery(group []byte) (number int64, low int64, high int64, ok bool)

func (*N2LayerGroupDB) ListArticleGroupRaw

func (g *N2LayerGroupDB) ListArticleGroupRaw(group []byte, first, last int64, targ func(int64, []byte))

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) ArticleGroupList

func (g *SimpleGroupDB) ArticleGroupList(group []byte, first, last int64, targ func(int64))

Efficient traversal of a newsgroup.

func (*SimpleGroupDB) ArticleGroupMove

func (g *SimpleGroupDB) ArticleGroupMove(group []byte, i int64, backward bool, id_buf []byte) (ni int64, id []byte, ok bool)

func (*SimpleGroupDB) ArticleGroupStat

func (g *SimpleGroupDB) ArticleGroupStat(group []byte, num int64, id_buf []byte) ([]byte, bool)

func (*SimpleGroupDB) AssignArticleToGroup

func (g *SimpleGroupDB) AssignArticleToGroup(group []byte, num, exp uint64, id []byte) error

func (*SimpleGroupDB) AssignArticleToGroups

func (g *SimpleGroupDB) AssignArticleToGroups(groups [][]byte, nums []int64, exp uint64, id []byte) (err error)

func (SimpleGroupDB) GroupHeadInsert

func (SimpleGroupDB) GroupHeadInsert(groups [][]byte, buf []int64) ([]int64, error)

EUnimplemented

func (SimpleGroupDB) GroupHeadRevert

func (SimpleGroupDB) GroupHeadRevert(groups [][]byte, nums []int64) error

EUnimplemented

func (*SimpleGroupDB) GroupRealtimeQuery

func (g *SimpleGroupDB) GroupRealtimeQuery(group []byte) (number int64, low int64, high int64, ok bool)

func (*SimpleGroupDB) ListArticleGroupRaw

func (g *SimpleGroupDB) ListArticleGroupRaw(group []byte, first, last int64, targ func(int64, []byte))

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL