Documentation ¶
Overview ¶
Storage methods, modeled after the venerable INN usenet server.
NOTE: All interfaces are WIP. Expect breaking changes.
Index ¶
- Variables
- func Bzero(bs []byte)
- func RegisterHisLoader(name string, ldr CfgHisLoader)
- func RegisterOverviewLoader(name string, ldr CfgOverviewLoader)
- func RegisterRiLoader(name string, ldr CfgRiLoader)
- func RegisterStorageLoader(name string, ldr CfgStorageLoader)
- type Article_MD
- type Article_R
- type Article_W
- type CfgBaseInfo
- type CfgHisLoader
- type CfgMaster
- type CfgOverviewLoader
- type CfgRiLoader
- type CfgStorage
- type CfgStorageLoader
- type CfgStorageMethod
- type Cursor
- type GroupElement
- type GroupMethod
- type HisMethod
- type OverviewElement
- type OverviewMethod
- type Releaser
- type RiElement
- type RiHistory
- type RiMethod
- type RiWriter
- type SMFlags
- type SMLevel
- type StorageManager
- type StorageMethod
- type TOKEN
Constants ¶
This section is empty.
Variables ¶
View Source
var ENotInitialized = errors.New("SM not Initialized")
Functions ¶
func RegisterHisLoader ¶
func RegisterHisLoader(name string, ldr CfgHisLoader)
func RegisterOverviewLoader ¶
func RegisterOverviewLoader(name string, ldr CfgOverviewLoader)
func RegisterRiLoader ¶
func RegisterRiLoader(name string, ldr CfgRiLoader)
func RegisterStorageLoader ¶
func RegisterStorageLoader(name string, ldr CfgStorageLoader)
Types ¶
type CfgBaseInfo ¶
type CfgBaseInfo struct {
Spool string `inn:"$spool"`
}
type CfgHisLoader ¶
type CfgMaster ¶
type CfgMaster struct { OvMethod string `inn:"$ovmethod"` HisMethod string `inn:"$hismethod"` RiMethod string `inn:"$rimethod"` Spool string `inn:"$pathspool"` }
General-Config.
func (*CfgMaster) BaseInfo ¶
func (cfg *CfgMaster) BaseInfo() *CfgBaseInfo
type CfgOverviewLoader ¶
type CfgOverviewLoader func(cfg *CfgMaster) (OverviewMethod, error)
type CfgRiLoader ¶
type CfgStorage ¶
type CfgStorage struct {
Methods []*CfgStorageMethod `inn:"@method"`
}
Storage-Config.
type CfgStorageLoader ¶
type CfgStorageLoader func(cfg *CfgStorageMethod, bi *CfgBaseInfo) (StorageMethod, error)
type CfgStorageMethod ¶
type GroupElement ¶
type GroupMethod ¶
type GroupMethod interface {
FetchGroups(status, descr bool, ge *GroupElement) (cur Cursor, err error)
}
type HisMethod ¶
type HisMethod interface { HisWrite(msgid []byte, md *Article_MD, t *TOKEN) (err error) HisLookup(msgid []byte, t *TOKEN) (err error) HisCancel(msgid []byte) (err error) }
Inspired by INN's HIS(history) database. Maps message-ids to storage tokens.
func OpenHisMethod ¶
type OverviewElement ¶
func (*OverviewElement) Debug ¶
func (ove *OverviewElement) Debug() string
type OverviewMethod ¶
type OverviewMethod interface { FetchOne(grp []byte, num int64, tk *TOKEN, ove *OverviewElement) (rel Releaser, err error) FetchAll(grp []byte, num, lastnum int64, tk *TOKEN, ove *OverviewElement) (cur Cursor, err error) SeekOne(grp []byte, num int64, back bool, tk *TOKEN, ove *OverviewElement) (rel Releaser, err error) GroupStat(grp []byte) (num, low, high int64, err error) // Writes a new Overview line into the database. GroupWriteOv(grp []byte, autonum bool, md *Article_MD, tk *TOKEN, ove *OverviewElement) (err error) // Deletes an Overview line from the database. CancelOv(grp []byte, num int64) (err error) // Initializes a group in the overview-database. InitGroup(grp []byte) (err error) }
func OpenOverviewMethod ¶
func OpenOverviewMethod(cfg *CfgMaster) (OverviewMethod, error)
type RiMethod ¶
type RiMethod interface { // Called for a sequence of group/number-pairs associated to the article // This method may return <nil>! RiBegin(msgid []byte) RiWriter // Performs a reverse index lookup: message-id to the first group/number pair. RiLookup(msgid []byte, rie *RiElement) (rel Releaser, err error) // Performs a reverse index lookup: message-id to all first group/number pairs. RiLookupAll(msgid []byte, rie *RiElement) (rel Cursor, err error) // Query Expired articles. SHOULD return message-ids after their group/number counterparts. RiQueryExpired(ow *time.Time, rih *RiHistory) (cur Cursor, err error) // Expires an article using the message-id. RiExpire(msgid []byte) (err error) }
Reverse Index. Maps message-ids to group/number-pairs.
func OpenRiMethod ¶
type RiWriter ¶
type RiWriter interface { // Called for the first group/number-pair associated to the article RiWrite(md *Article_MD, rie *RiElement) (err error) // Called for the remaining group/number-pair associated to the article RiWriteMore(md *Article_MD, rie *RiElement) (err error) // Called at after all group/number-pair have been associated. RiCommit() (err error) }
type StorageManager ¶
type StorageManager struct { Classes [256]StorageMethod Methods [256]*CfgStorageMethod /* Used by the Posting backend. Will hold *fastnntp.WildMat objects. */ Wildmat [256]interface{} }
func (*StorageManager) Cancel ¶
func (s *StorageManager) Cancel(t *TOKEN) (err error)
func (*StorageManager) Open ¶
func (s *StorageManager) Open(bi *CfgBaseInfo) (err error)
func (*StorageManager) SetMethods ¶
func (s *StorageManager) SetMethods(cfg *CfgStorage)
type StorageMethod ¶
Directories ¶
Path | Synopsis |
---|---|
Stores overview data into a LevelDB database.
|
Stores overview data into a LevelDB database. |
Stores reverse index data into a LevelDB database.
|
Stores reverse index data into a LevelDB database. |
Implements a traditional storage method, where each article is stored in a separate file.
|
Implements a traditional storage method, where each article is stored in a separate file. |
Implements a traditional newsgroup-listing solution.
|
Implements a traditional newsgroup-listing solution. |
Click to show internal directories.
Click to hide internal directories.