filebacked

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package filebacked provides file-backed collections.

Index

Constants

View Source
const (
	Extension = ".fb"
)

Extension is File extension.

Variables

View Source
var WorkingDir = "/tmp"

WorkingDir is the directory used to stored files.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Catalog of types.

type EmptyIterator

type EmptyIterator struct {
}

EmptyIterator is an empty iterator.

func (*EmptyIterator) At

func (*EmptyIterator) At(int) any

func (*EmptyIterator) AtWith

func (*EmptyIterator) AtWith(int, any)

func (*EmptyIterator) Close

func (*EmptyIterator) Close()

func (*EmptyIterator) Len

func (*EmptyIterator) Len() int

func (*EmptyIterator) Next

func (*EmptyIterator) Next() (any, bool)

func (*EmptyIterator) NextWith

func (*EmptyIterator) NextWith(object any) bool

func (*EmptyIterator) Reverse

func (*EmptyIterator) Reverse()

type FbIterator

type FbIterator struct {
	// Reader.
	*Reader
	// contains filtered or unexported fields
}

FbIterator is a filebacked iterator.

func (*FbIterator) Next

func (r *FbIterator) Next() (object any, hasNext bool)

Next object.

func (*FbIterator) NextWith

func (r *FbIterator) NextWith(object any) (hasNext bool)

NextWith returns the next object.

func (*FbIterator) Reverse

func (r *FbIterator) Reverse()

Reverse the list.

type Iterator

type Iterator interface {
	// Len returns the number of items.
	Len() int
	// Reverse the content.
	Reverse()
	// At returns the object at index.
	At(index int) any
	// AtWith populates with the objet at index.
	AtWith(int, any)
	// Next returns the next object.
	Next() (any, bool)
	// NextWith returns the next object (with).
	NextWith(object any) bool
	// Close the iterator.
	Close()
}

Iterator interface. Read-only collection with stateful iteration.

type List

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

List is a File-backed list.

func NewList

func NewList() (list *List)

NewList returns a new list.

func (*List) Append

func (l *List) Append(object any)

Append an object.

func (*List) At

func (l *List) At(index int) (object any)

At returns the object at index.

func (*List) AtWith

func (l *List) AtWith(index int, object any)

AtWith populates with the object at index.

func (*List) Close

func (l *List) Close()

Close (delete) the list.

func (*List) Iter

func (l *List) Iter() (itr Iterator)

Iter returns an iterator.

func (*List) Len

func (l *List) Len() int

Len returns the number of objects.

type Reader

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

Reader performs reading.

func (*Reader) At

func (r *Reader) At(index int) (object any)

At returns the object at index.

func (*Reader) AtWith

func (r *Reader) AtWith(index int, object any)

AtWith get the object at index.

func (*Reader) Close

func (r *Reader) Close()

Close the reader.

func (*Reader) Len

func (r *Reader) Len() (length int)

Len returns the number of objects in the list.

type Writer

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

Writer performs writing.

func (*Writer) Append

func (w *Writer) Append(object any)

Append (write) object.

func (*Writer) Close

func (w *Writer) Close()

Close the writer.

func (*Writer) Reader

func (w *Writer) Reader(shared bool) (reader *Reader)

Reader builds a reader.

Jump to

Keyboard shortcuts

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