types

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrueStr  = "true"
	FalseStr = "false"
)
View Source
const FastMetaMaxSize = 128 * 1024

The maximum size of the FastMeta is 128kb

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary added in v0.0.15

type Binary bool

func (Binary) Bytes added in v0.0.15

func (b Binary) Bytes() []byte

func (Binary) String added in v0.0.15

func (b Binary) String() string

type Chunk added in v0.0.15

type Chunk struct {
	ChunkMeta
	Data []byte // The actual data chunk
}

type ChunkCollection added in v0.0.15

type ChunkCollection []Chunk

type ChunkMeta added in v0.0.15

type ChunkMeta struct {
	Hash       Hash   // SHA-512 hash
	DataLength uint32 // The length of the data chunk
}

type ChunkMetaCollection added in v0.0.15

type ChunkMetaCollection []ChunkMeta

func (ChunkMetaCollection) Hash added in v0.0.15

func (c ChunkMetaCollection) Hash() Hash

type Event

type Event struct {
	EventIdentifier                     // This will be used to identify the event it includes  EventHash, EventType, FastMeta
	Level           Level               // unix timestamp of creation time UTC
	Metadata        ChunkMetaCollection // If no metadata is present the metadata of the the next previous event with metadata is used
	Content         ChunkMetaCollection // all hashes in a certain order that allow to reconstruct the content from the values in badgerDB
	ParentEvent     Hash                // the event this item is the child of
	RootEvent       Hash                // the first event that marks a now EventChain
	Temporary       Binary              // no non-Temporary event can have a Temporary event as Parent, Temporary events will be removed after some conditions are met, if one deletes a Temporary event all its children will be deleted too
	FullTextSearch  Binary              // if true the ContentHashes and MetadataHashes of the event will be used for full-text search, Important: this only applies to the event itself, not to its children
}

Event represents an event in the EventChain, the absolute top of a EventChain is a RootEvent, look at rootEvents.go

func (*Event) CreateDetailsMetaHash

func (item *Event) CreateDetailsMetaHash() Hash

func (*Event) Key

func (item *Event) Key() EventKeyBytes

func (Event) MarshalJSON

func (item Event) MarshalJSON() ([]byte, error)

func (*Event) PrettyPrint

func (item *Event) PrettyPrint()

type EventIdentifier added in v0.0.15

type EventIdentifier struct {
	EventHash Hash      // SHA-512 hash of all other fields in this struct
	EventType EventType // Defines what behavior the event event should have.
	FastMeta  FastMeta  // FastMeta allows for metadata to be stored in the description of the event itself, what leads to faster access without indexing. The maximum size of the FastMeta is 128kb
}

type EventKeyBytes added in v0.0.15

type EventKeyBytes []byte

func (EventKeyBytes) Deserialize added in v0.0.15

func (ekb EventKeyBytes) Deserialize() (*EventIdentifier, error)

type EventType added in v0.0.15

type EventType int

EventType defines how the event should behave, for example if i get the File of a Patch event i will get the finishes file with all previous patches applied TODO explain in more detail

const (
	Normal EventType = iota
	Overwrite
	Patch
	Root
)

func (EventType) Bytes added in v0.0.15

func (e EventType) Bytes() []byte

func (*EventType) FromBytes added in v0.0.15

func (e *EventType) FromBytes(b []byte) error

func (EventType) String added in v0.0.15

func (e EventType) String() string

type FastMeta added in v0.0.15

type FastMeta []FastMetaParameter

FastMeta allows for metadata to be stored in the description of the event itself, what leads to faster access without indexing. FastMeta will be stored in the key and not the value of the underlying key-value store.

func (FastMeta) Bytes added in v0.0.15

func (*FastMeta) FromBytes added in v0.0.15

func (f *FastMeta) FromBytes(data FastMetaBytesSerialized) error

func (FastMeta) Hash added in v0.0.15

func (f FastMeta) Hash() Hash

func (FastMeta) IsToBig added in v0.0.15

func (f FastMeta) IsToBig() bool

func (FastMeta) Size added in v0.0.15

func (f FastMeta) Size() int

func (FastMeta) SizeLeft added in v0.0.15

func (f FastMeta) SizeLeft() int

type FastMetaBytesSerialized added in v0.0.15

type FastMetaBytesSerialized []byte

type FastMetaParameter added in v0.0.15

type FastMetaParameter []byte

FastMetaParameter is a single parameter of FastMeta

func (FastMetaParameter) String added in v0.0.17

func (f FastMetaParameter) String() string

type Hash added in v0.0.15

type Hash [64]byte

func (Hash) Bytes added in v0.0.15

func (h Hash) Bytes() []byte

func (*Hash) HashFromBytes added in v0.0.15

func (h *Hash) HashFromBytes(b []byte) error

func (Hash) String added in v0.0.15

func (h Hash) String() string

type Level added in v0.0.15

type Level int64

This is a unix timestamp in nanoseconds It is used to have some idea of the time of creation of an event. We recognize that the time of computer systems is not reliable, that is why we call it Level, instead of creation time.

func (Level) Bytes added in v0.0.15

func (l Level) Bytes() []byte

func (*Level) SetToNow added in v0.0.15

func (l *Level) SetToNow()

func (Level) String added in v0.0.15

func (l Level) String() string

func (Level) Time added in v0.0.15

func (l Level) Time() time.Time

type RootEventsIndex

type RootEventsIndex struct {
	Title []byte
	Hash  Hash
}

func (RootEventsIndex) MarshalJSON

func (indexItem RootEventsIndex) MarshalJSON() ([]byte, error)

type Title added in v0.0.15

type Title string

Title can be used as a category, pseudo type, or name of an event. Its primary purpose is to speed up the search for events. Its most important use is to have root events with a somewhat unique title, so one can find a fast entry point to a desired EventChain.

func (Title) Bytes added in v0.0.15

func (t Title) Bytes() []byte

Jump to

Keyboard shortcuts

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