Documentation ¶
Index ¶
- Variables
- type ArchiveManager
- type Container
- func (c *Container[P, RowType]) AcquireContainer() *sbt.Container[P, RowType]
- func (c *Container[P, RowType]) AsIterable() generics.Iterable[containers.Tuple[*MultiContainerIteratorKey, P]]
- func (c *Container[P, RowType]) Close() (err error)
- func (c *Container[P, RowType]) Iter() *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]]
- func (c *Container[P, RowType]) IterHandler(iter *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]])
- func (c *Container[P, RowType]) IterRange(start, end time.Time) *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]]
- func (c *Container[P, RowType]) ReleaseContainer()
- type MultiContainerFilenameParts
- type MultiContainerIteratorKey
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var ErrNoFileFound = errors.New("no file found")
Functions ¶
This section is empty.
Types ¶
type ArchiveManager ¶
type ArchiveManager struct {
// contains filtered or unexported fields
}
ArchiveManager manages the archives of the multi container
func NewArchiveManager ¶
func NewArchiveManager(rootDir, prefix string, compQueueBufSize, compPoolSize int) (am *ArchiveManager, err error)
NewArchiveManager creates a new archive manager
func (*ArchiveManager) CleanCompress ¶
func (am *ArchiveManager) CleanCompress() error
CleanCompress does this to root dir:
- Ignore files with prefix and .sbt extension if there's a compressed version
- Compress any file with prefix and .sbt extension
func (*ArchiveManager) Files ¶
Files returns the decompressed filename channel. This function panics on error, make sure to recover.
func (*ArchiveManager) QueueCompression ¶
func (am *ArchiveManager) QueueCompression(filename string)
QueueCompression queues files for compression. filename should be the full path to the file (starting at rootDir)
type Container ¶ added in v0.1.0
type Container[P generics.Ptr[RowType], RowType any] struct { // contains filtered or unexported fields }
Container is a AcquireContainer wrapper allowing data insertion in multiple serial files with archive control to save space.
It use a predefined filename format for identifying files. The format is <prefix>_<date 2006-01-02-15-04>_<unix time>.sbt
func NewContainer ¶ added in v0.1.0
func NewContainer[P generics.Ptr[RowType], RowType any]( rootDir, prefix string, options ...Option, ) (c *Container[P, RowType], err error)
NewContainer creates a new Container and loads the last container file based on the mode
func (*Container[P, RowType]) AcquireContainer ¶ added in v0.1.0
AcquireContainer returns the current container in a thread safe way. MAKE SURE to call ReleaseContainer when done, otherwise the container will be locked forever.
func (*Container[P, RowType]) AsIterable ¶ added in v0.1.0
func (c *Container[P, RowType]) AsIterable() generics.Iterable[containers.Tuple[*MultiContainerIteratorKey, P]]
func (*Container[P, RowType]) Close ¶ added in v0.1.0
Close closes the current container and the archive scheduler
func (*Container[P, RowType]) Iter ¶ added in v0.1.0
func (c *Container[P, RowType]) Iter() *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]]
Iter will begin iteration from the very first found file
func (*Container[P, RowType]) IterHandler ¶ added in v0.1.0
func (c *Container[P, RowType]) IterHandler( iter *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]], )
func (*Container[P, RowType]) IterRange ¶ added in v0.1.0
func (c *Container[P, RowType]) IterRange( start, end time.Time, ) *generics.Iterator[containers.Tuple[*MultiContainerIteratorKey, P]]
IterRange will begin iteration from the first found file and will stop at the last found file
func (*Container[P, RowType]) ReleaseContainer ¶ added in v0.1.0
func (c *Container[P, RowType]) ReleaseContainer()
ReleaseContainer releases the current container.
type MultiContainerFilenameParts ¶
type MultiContainerFilenameParts struct {
// contains filtered or unexported fields
}
func NewMultiContainerFilenamePartsFromNow ¶
func NewMultiContainerFilenamePartsFromNow(prefix string) MultiContainerFilenameParts
NewMultiContainerFilenamePartsFromNow creates a new MultiContainerFilenameParts from now
func SplitMultiContainerFilename ¶
func SplitMultiContainerFilename(filename string, tz *time.Location) (parts MultiContainerFilenameParts, err error)
SplitMultiContainerFilename splits a filename into parts
func (MultiContainerFilenameParts) Date ¶
func (p MultiContainerFilenameParts) Date() time.Time
Date
func (MultiContainerFilenameParts) Prefix ¶
func (p MultiContainerFilenameParts) Prefix() string
Prefix
func (MultiContainerFilenameParts) String ¶
func (p MultiContainerFilenameParts) String() string
String returns the filename
type Option ¶
type Option func(*Options)
func WithCompressionPoolSize ¶
WithCompressionPoolSize sets the size of the compression worker pool. Defaults to NumCPU / 4.
func WithOpenRead ¶ added in v0.1.0
func WithOpenRead() Option
WithOpenRead sets the container to open the file for reading. Defaults to false.