dropbag

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type CloseRetainer

type CloseRetainer interface {
	// guarantees that this object will not be closed until the returned Closer.Close() is called
	// multiple retainers are allowed, all of them must be closed to release the object
	// can return nil when retention guarantee is not possible (object is closed already)
	Retain() io.Closer
}

type CompositeDropPerPulseData

type CompositeDropPerPulseData interface {
	CoveringRange() pulse.Range // latest PulseData + earliest pulse number - will not include intermediate PulseData
	PulseDataCount() int
	GetPerPulseData(index int) DropPerPulseData
	FindPerPulseData(pulse.Number) DropPerPulseData
}

type CompositeDropStorage

type CompositeDropStorage interface {
	CloseRetainer

	CoveringRange() pulse.Range // latest PulseData + earliest pulse number - will not include intermediate PulseData
	PerPulseData() CompositeDropPerPulseData

	// identified by the latest pulse in a range of the drop
	GetDropStorage(jetId jet.ExactID, pn pulse.Number) DropStorage

	NoticeUsage()
}

type CompositeDropStorageBuilder

type CompositeDropStorageBuilder interface {
	CompositeDropStorageBuilder()
}

type DropEntry

type DropEntry interface {
	Key() keyset.Key

	// actual directory this entry is listed in
	DirectorySectionId() DropSectionId
	// a sequential order for all entries being of a drop
	// for regular entry starts from 256 and goes up
	SequenceId() uint32

	// section of entry's content
	ContentSectionId() DropSectionId

	PeekEntry(ObjectExtractor) bool
	GetEntryUnbound(ObjectExtractor) (value interface{}, hasValue bool)
}

type DropJetTree

type DropJetTree interface {
	MinDepth() uint8
	MaxDepth() uint8
	Count() int
	PrefixToJetId(prefix jet.Prefix) jet.ExactID
	KeyToJetId(keyset.Key) jet.ExactID
}

type DropLifeline

type DropLifeline interface {
}

type DropPerPulseData

type DropPerPulseData interface {
	PulseRange() pulse.Range // complete range, with all pulse data included
	JetTree() DropJetTree

	OnlinePopulation() census.OnlinePopulation
	OfflinePopulation() census.OfflinePopulation
}

type DropSection

type DropSection interface {
	DropSectionId() DropSectionId
	DirectorySectionId() DropSectionId

	LoadEntry(DropEntry, ObjectExtractor) error
	LoadEntries([]DropEntry, ObjectExtractor) error
}

type DropSectionDirectory

type DropSectionDirectory interface {
	DropSectionId() DropSectionId

	LookupKey(keyset.Key) (DropEntry, bool)
	LookupKeySet(keyset.KeySet) LookupPager
}

type DropSectionId

type DropSectionId uint8
const (
	// a special section that can't be used directly
	DropControlSection DropSectionId = iota

	// main persistent section
	MainDropSection

	// limited persistence section
	DustDropSection
)
const MinCustomDropSection DropSectionId = 16

type DropStorage

type DropStorage interface {
	CloseRetainer

	Composite() CompositeDropStorage

	JetId() jet.LegID
	PulseNumber() pulse.Number // the rightmost/latest pulse number of this drop
	PerPulseData() DropPerPulseData

	DropType() DropType

	// a synthetic directory based on a few sections, marked as primary
	MainDirectory() DropSectionDirectory

	FindSection(DropSectionId) DropSection
	FindDirectory(DropSectionId) DropSectionDirectory
}

type DropStorageBuilder

type DropStorageBuilder interface {
}

type DropStorageManager

type DropStorageManager interface {
	// will actually open CompositeDropStorage that may have multiple DropStorage(s) incorporated
	OpenStorage(jetId jet.ExactID, pn pulse.Number) (DropStorage, error)
	OpenPulseStorage(pn pulse.Number) (CompositeDropPerPulseData, error)

	// each storage is lazy-closed, but can be explicitly marked for closing
	UnusedStorage(CompositeDropStorage)

	// returns nil when the required storage is not open
	GetOpenedStorage(jetId jet.ExactID, pn pulse.Number) DropStorage

	BuildStorage(pr pulse.Range) CompositeDropStorageBuilder
}

type DropType

type DropType uint8
const (
	RegularDropType DropType
	SummaryDropType
	ArchivedDropType
)

type EntryCollection

type EntryCollection interface {
}

type EntryPosition

type EntryPosition struct {
	StorageLoc StorageLocId
	SequenceId uint32
	StorageOfs int64
}

func (EntryPosition) IsZero

func (v EntryPosition) IsZero() bool

func (EntryPosition) NotFound

func (v EntryPosition) NotFound() bool

type EntryStorageAdapter

type EntryStorageAdapter interface {
}

type EntryStorageCabinet

type EntryStorageCabinet interface {
}

type EntryStorageShelf

type EntryStorageShelf interface {
}

type ExtractorId

type ExtractorId string

type FieldId

type FieldId uint16

type FieldOffset

type FieldOffset int
const (
	InvalidField FieldOffset = 0 - iota
	AbsentField
	SearchField
)

type FieldOffsetMap

type FieldOffsetMap interface {
	FindField(int FieldId) FieldOffset
}

type JetDrop

type JetDrop interface {
	PulseNumber() pulse.Number
	GetGlobulaPulse() JetPulse

	FindEntryByKey(longbits.ByteString) JetDropEntry
	//	GetSectionDirectory(JetSectionId) JetDropSection
	GetSection(JetSectionId) JetDropSection
}

type JetDropEntry

type JetDropEntry interface {
	Key() longbits.ByteString
	Section() JetDropSection
	IsAvailable() bool
	Data() []byte
}

type JetDropSection

type JetDropSection interface {
	EnumEntries()
}

type JetPulse

type JetPulse interface {
	GetOnlinePopulation() census.OnlinePopulation
	GetPulseData() pulse.Range
}

type JetSectionDeclaration

type JetSectionDeclaration interface {
	HasDirectory() bool
	//IsSorted
	HasPayload() bool
}

type JetSectionDirectory

type JetSectionDirectory interface {
	FindByKey(longbits.ByteString) JetDropEntry
	EnumKeys()
}

type JetSectionId

type JetSectionId uint16
const (
	DefaultSection JetSectionId = iota // MapSection
	ControlSection                     // drop/dropbag lifecycle
	DustSection                        // transient, general, stays for some time (e.g. log)
	GasSection                         // transient, requests, stays until processed
)

type JetSectionType

type JetSectionType uint8
const (
	DirectorySection JetSectionType = 1 << iota //
	TransientSection
	CustomCryptographySection
)

type KeyEntryCollection

type KeyEntryCollection struct {
	// contains filtered or unexported fields
}

func (*KeyEntryCollection) FindKey

type KeySet

type KeySet interface {
}

type LazyEntryCollection

type LazyEntryCollection struct {
	// contains filtered or unexported fields
}
type CompleteEntryCollection struct {
	storageLoc StorageLocId
	entries    []StructEntry
}
func (p CompleteEntryCollection) GetEntryBySeq(seq uint32) (bool, StructEntry) {
	if seq >= uint32(len(p.entries)) {
		return true, StructEntry{}
	}
	return true, p.entries[seq]
}
func (p CompleteEntryCollection) GetEntryByPos(pos EntryPosition) (bool, StructEntry) {
	switch {
	case pos.NotFound():
		panic("illegal value")
	case pos.StorageLoc != p.storageLoc:
		panic("illegal value")
	}
	return p.GetEntryBySeq(pos.SequenceId)
}

func (*LazyEntryCollection) GetEntryByPos

func (p *LazyEntryCollection) GetEntryByPos(pos EntryPosition) (bool, StructEntry)

func (*LazyEntryCollection) GetEntryBySeq

func (p *LazyEntryCollection) GetEntryBySeq(seq uint32) (bool, StructEntry)

func (*LazyEntryCollection) LoadEntries

func (p *LazyEntryCollection) LoadEntries(posList []EntryPosition, loadFn func(EntryPosition) StructEntry)

type LookupMiss

type LookupMiss uint8
const (
	LookupUnknown LookupMiss = iota
	LookupNotFound
)

type LookupPageFunc

type LookupPageFunc func(estTotal, curTotal uint, found []DropEntry, misses [][]keyset.Key, skipped uint) bool

type LookupPager

type LookupPager interface {
	RequestedKeySet() keyset.KeySet

	LoadKeys(maxPageSize uint, fn LookupPageFunc) error
	PeekKeys(maxPageSize uint, fn LookupPageFunc)
}

type ObjectExtractor

type ObjectExtractor interface {
	// extractors with the same id will share cached values etc
	ExtractorId() ExtractorId

	// Invoked when an entry has no cached value for this extractor id.
	// Extracts required data from the raw bytes and consumes it (process further).
	// The extracted result must be returned for caching.
	// Return:
	// 	(cacheValue) the extracted value
	// 	(boundValue) true when cacheValue depends on (raw), as it can be memory mapped and needs cleanup
	//  (estSize) approximate memory size of the extracted value, for cache eviction procedure.
	Extract(key keyset.Key, raw []byte) (cacheValue interface{}, boundValue bool, estSize uint)

	// Invoked when an entry has cached value for this extractor id.
	Reuse(key keyset.Key, cacheValue interface{}, boundValue bool)

	// Invoked by GetUnboundObject() when a cached value is bound.
	// This function must return an unbound copy of the (cacheValue).
	Unbind(cacheValue interface{}) interface{}
}

This interface is a combination of data extractor and consumer. It extracts (converts) from raw data into a target type, then process it.

type StorageFile

type StorageFile interface {
}

type StorageFileFolder

type StorageFileFolder interface {
}

type StorageFileReader

type StorageFileReader interface {
}

type StorageFormatAdapter

type StorageFormatAdapter interface {
}

type StorageLocId

type StorageLocId uint32

type StorageReadAdapter

type StorageReadAdapter interface {
	GetURI() StorageURI

	OpenForSeqRead() dbcommon.StorageSeqReader
	OpenForBlockRead() dbcommon.StorageBlockReader
}

type StorageURI

type StorageURI string

type StructEntry

type StructEntry struct {
	// contains filtered or unexported fields
}

func (StructEntry) NotFound

func (v StructEntry) NotFound() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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