universe

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Content   []byte
	Embedding []float64
	// contains filtered or unexported fields
}

Chunk is a chunk of content.

func NewChunk

func NewChunk(content []byte) *Chunk

NewChunk creates a new chunk from content.

func UnmarshalCompressed

func UnmarshalCompressed(data []byte) (c *Chunk, err error)

UnmarshalCompressed unmarshals a chunk from compressed data.

func (*Chunk) Hash

func (c *Chunk) Hash() string

Hash returns the hash of a chunk.

func (*Chunk) MarshalCompressed

func (c *Chunk) MarshalCompressed() (hash string, data []byte, err error)

MarshalCompressed marshals a chunk to compressed data for storing in the database. Like git, we add an object header, then compute the hash of the header and content, then compress the header and content.

type Universe

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

func Open

func Open(path string) (u *Universe, err error)

Open opens the universe, creating kv db and its buckets if it doesn't exist.

Buckets: - name: chunk, key: content hash, value: content chunk - name: embedding, key: content hash, value: embedding - name: root, key: document path, value: merkle hash - name: tree, key: merkle hash, value: list of hashes of trees or chunks

func (*Universe) Close

func (u *Universe) Close() error

Close closes the universe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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