messagedb

package
v0.0.0-...-d5b6aee Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CeAbstractBlob

func CeAbstractBlob() serializer.CodecElement

func CeArticlePosting

func CeArticlePosting() serializer.CodecElement

func CeArticleRedirectPtr

func CeArticleRedirectPtr() serializer.CodecElement

func CeArticleXover

func CeArticleXover() serializer.CodecElement

func CeArticleXoverStruct

func CeArticleXoverStruct() serializer.CodecElement

func CeXoverElement

func CeXoverElement() serializer.CodecElement

Types

type AbstractBlob

type AbstractBlob interface {
	IsDirect() bool
}

func Decompress

func Decompress(b AbstractBlob) AbstractBlob

Decompresses a blob (LZ4).

If b is nil, it returns nil. If b isn't a compressed Blob, it returns b unmodified. If b is compressed, but a non-decompressible Blob (corrupted or erroneous), it returns nil.

type ArticleLocation

type ArticleLocation struct {
	Head AbstractBlob
	Body AbstractBlob
}

type ArticlePosting

type ArticlePosting struct {
	Xover ArticleXover
	Redir *ArticleRedirect
	Head  AbstractBlob
	Body  AbstractBlob

	// Compression hints.
	HeadComp CompressionHint
	BodyComp CompressionHint
}

type ArticleRedirect

type ArticleRedirect struct {
	Group  []byte
	Number int64
}

type ArticleXover

type ArticleXover struct {
	Subject []byte
	From    []byte
	Date    []byte
	MsgId   []byte
	Refs    []byte
	Bytes   int64
	Lines   int64

	// This timestamp is used for purging old Entries.
	TimeStamp int64 // Timestamp (UNIX-Format).
}

type BlobDirect

type BlobDirect struct{ Content []byte }

func (*BlobDirect) IsDirect

func (b *BlobDirect) IsDirect() bool

type BlobLocation

type BlobLocation struct {
	Node   *uuid.UUID
	DayID  int
	Offset int64
	Length int64
}

func (*BlobLocation) IsDirect

func (b *BlobLocation) IsDirect() bool

type BlobLz4Compressed

type BlobLz4Compressed struct {
	UCLen      int
	Lz4Content []byte
}

func (*BlobLz4Compressed) IsDirect

func (b *BlobLz4Compressed) IsDirect() bool

type CompressionHint

type CompressionHint byte
const (
	CH_None   CompressionHint = 0
	CH_LZ4    CompressionHint = 'z'
	CH_LZ4_HC CompressionHint = 'H'
)

func (CompressionHint) Compress

func (CompressionHint) Lz4UseHC

func (c CompressionHint) Lz4UseHC() bool

func (CompressionHint) UseLz4

func (c CompressionHint) UseLz4() bool

type Dayfile

type Dayfile struct {
	File *os.File
	// contains filtered or unexported fields
}

func (*Dayfile) Add

func (d *Dayfile) Add(node *uuid.UUID, dayid int, ch CompressionHint, b AbstractBlob) (AbstractBlob, error)

func (*Dayfile) Drop

func (d *Dayfile) Drop()

func (*Dayfile) Grab

func (d *Dayfile) Grab() *Dayfile

func (*Dayfile) Read

func (d *Dayfile) Read(b *BlobLocation) (res AbstractBlob, err error)

type DayfileCache

type DayfileCache struct {
	Folder string
	NodeID *uuid.UUID
	// contains filtered or unexported fields
}

func (*DayfileCache) AddDayfileBlob

func (dfc *DayfileCache) AddDayfileBlob(dayid int, ch CompressionHint, b AbstractBlob) AbstractBlob

func (*DayfileCache) Close

func (dfc *DayfileCache) Close() error

func (*DayfileCache) FreeDayfileStorage

func (dfc *DayfileCache) FreeDayfileStorage() int64

func (*DayfileCache) GetDayfileNodeID

func (dfc *DayfileCache) GetDayfileNodeID() *uuid.UUID

func (*DayfileCache) GetFile

func (dfc *DayfileCache) GetFile(dayid int) *Dayfile

func (*DayfileCache) Init

func (dfc *DayfileCache) Init(f LruCacheFactory) error

func (*DayfileCache) ReadDayfileBlob

func (dfc *DayfileCache) ReadDayfileBlob(b AbstractBlob) AbstractBlob

type GrpArtDB

type GrpArtDB struct {
	DB *bolt.DB
}

func (*GrpArtDB) GetArticle

func (g *GrpArtDB) GetArticle(group []byte, num int64, head, body bool) (headPtr, bodyPtr AbstractBlob, ok bool)

func (*GrpArtDB) GetXover

func (g *GrpArtDB) GetXover(group []byte, first, last int64, max int) (result []XoverElement)

func (*GrpArtDB) Initialize

func (g *GrpArtDB) Initialize() error

func (*GrpArtDB) PutArticle

func (g *GrpArtDB) PutArticle(group []byte, num int64, ap *ArticlePosting) (ok bool)

type IDayfileNode

type IDayfileNode interface {
	GetDayfileNodeID() *uuid.UUID
	FreeDayfileStorage() int64
	AddDayfileBlob(dayid int, ch CompressionHint, b AbstractBlob) AbstractBlob
	ReadDayfileBlob(b AbstractBlob) AbstractBlob
}

type IGrpArtDB

type IGrpArtDB interface {
	PutArticle(group []byte, num int64, ap *ArticlePosting) (ok bool)
	GetArticle(group []byte, num int64, head, body bool) (headPtr, bodyPtr AbstractBlob, ok bool)
	GetXover(group []byte, first, last int64, max int) (result []XoverElement)
}

type IMsgidIndexDB

type IMsgidIndexDB interface {
	GetMessageLocation(messageID []byte) (articlePos *ArticleRedirect)
	UpdateMessageLocation(messageID []byte, articlePos *ArticleRedirect, timestamp int64) (ok bool)
}

type LruCache

type LruCache interface {
	Add(key, value interface{}) bool
	Contains(key interface{}) (ok bool)
	Get(key interface{}) (value interface{}, ok bool)
	Purge()
	Remove(key interface{}) bool
}

type LruCacheFactory

type LruCacheFactory func(e simplelru.EvictCallback) (LruCache, error)

func NewLruCache

func NewLruCache(size int) LruCacheFactory

Returns a simplistic LRU-Cache instance.

type MsgidIndexDB

type MsgidIndexDB struct {
	DB *bolt.DB
}

func (*MsgidIndexDB) GetMessageLocation

func (g *MsgidIndexDB) GetMessageLocation(messageID []byte) (articlePos *ArticleRedirect)

func (*MsgidIndexDB) Initialize

func (g *MsgidIndexDB) Initialize() error

func (*MsgidIndexDB) UpdateMessageLocation

func (g *MsgidIndexDB) UpdateMessageLocation(messageID []byte, articlePos *ArticleRedirect, timestamp int64) (ok bool)

type XoverElement

type XoverElement struct {
	Number int64
	Xover  ArticleXover
}

Jump to

Keyboard shortcuts

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