engine

package
v0.0.0-...-87acd47 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType = string

type NabiaDB

type NabiaDB struct {
	Records sync.Map
	// contains filtered or unexported fields
}

func NabiaDBFromFile

func NabiaDBFromFile(location string) (*NabiaDB, error)

func NewNabiaDB

func NewNabiaDB(location string) (*NabiaDB, error)

func (*NabiaDB) Destroy

func (ns *NabiaDB) Destroy(key string)

Destroy takes a key and removes it from the map. This method doesn't have existence-checking logic. It is safe to use on empty data, it simply doesn't do anything if the record doesn't exist. -1 size if the key exists +1 write

func (*NabiaDB) Exists

func (ns *NabiaDB) Exists(key string) bool

Exists checks if the key name provided exists in the Nabia map. It locks to read and unlocks immediately after. +1 read

func (*NabiaDB) Read

func (ns *NabiaDB) Read(key string) (NabiaRecord, error)

Read takes a key name and attempts to pull the data from the Nabia DB map. Returns a NabiaRecord (if found) and an error (if not found). Callers must always check the error returned in the second parameter, as the result cannot be used if the "error" field is not nil. This function is safe to call even with empty data, because the method applies a mutex. +1 read

func (*NabiaDB) Stop

func (ns *NabiaDB) Stop()

func (*NabiaDB) Write

func (ns *NabiaDB) Write(key string, value NabiaRecord) error

Write takes the key and a value of NabiaRecord datatype and places it on the database, potentially overwriting whatever was there before, because Write has no data safety features preventing the overwriting of data. +1 write when validation passes +1 size if the key is new

type NabiaRecord

type NabiaRecord struct {
	RawData     []byte
	ContentType ContentType // "Content-Type" https://datatracker.ietf.org/doc/html/rfc2616/#section-14.17
}

func NewNabiaRecord

func NewNabiaRecord(data []byte, ct ContentType) *NabiaRecord

func NewNabiaString

func NewNabiaString(s string) *NabiaRecord

Jump to

Keyboard shortcuts

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