internal

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package internal contains internal implementation details

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the tagged release version in the form <major>.<minor>.<patch>
	// following semantic versioning and is overwritten by the build system.
	Version = defaultVersion

	// Commit is the commit sha of the build (normally from Git) and is overwritten
	// by the build system.
	Commit = defaultCommit

	// Build is the date and time of the build as an RFC3339 formatted string
	// and is overwritten by the build system.
	Build = defaultBuild
)

Functions

func Copy

func Copy(src, dst string, exclude []string) error

Copy copies source contents to destination

func DirSize

func DirSize(path string) (int64, error)

DirSize returns the space occupied by the given `path` on disk on the current file system.

func Exists

func Exists(path string) bool

Exists returns `true` if the given `path` on the current file system exists

func FullVersion

func FullVersion() string

FullVersion display the full version and build

func GetDatafiles

func GetDatafiles(path string) ([]string, error)

GetDatafiles returns a list of all data files stored in the database path given by `path`. All datafiles are identified by the the glob `*.data` and the basename is represented by a monotonic increasing integer. The returned files are *sorted* in increasing order.

func LoadFromJSONFile

func LoadFromJSONFile(path string, v interface{}) error

LoadFromJSONFile reads file located at `path` and put its content in json format in v

func ParseIds

func ParseIds(fns []string) ([]int, error)

ParseIds will parse a list of datafiles as returned by `GetDatafiles` and extract the id part and return a slice of ints.

func SaveJSONToFile

func SaveJSONToFile(v interface{}, path string, mode os.FileMode) error

SaveJSONToFile converts v into json and store in file identified by path

Types

type Entry

type Entry struct {
	Checksum uint32
	Key      []byte
	Value    []byte
}

Entry represents a key/value in the database

func NewEntry

func NewEntry(key, value []byte) Entry

NewEntry creates a new `Entry` with the given `key` and `value`

type Item

type Item struct {
	FileID int   `json:"fileid"`
	Offset int64 `json:"offset"`
	Size   int64 `json:"size"`
}

Item represents the location of the value on disk. This is used by the internal Adaptive Radix Tree to hold an in-memory structure mapping keys to locations on disk of where the value(s) can be read from.

Directories

Path Synopsis
Package codec implements binary encoding and decoding for database entries
Package codec implements binary encoding and decoding for database entries
Package config defines configuration details and functions to load and save configuration to disk
Package config defines configuration details and functions to load and save configuration to disk
Package data implements on disk and in memory storage for data files
Package data implements on disk and in memory storage for data files
Package index deals with reading and writing database indexes
Package index deals with reading and writing database indexes

Jump to

Keyboard shortcuts

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