db

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_INVALID_ID       = errors.New("Invalid ID specified.")
	ERR_STORE_NOT_FOUND  = errors.New("Store not found.")
	ERR_RECORD_NOT_FOUND = errors.New("Record not found.")
)
View Source
var (
	Size = uint64(0)
)

Functions

func CountExpired

func CountExpired() (total int, prunable int, err error)

func Delete

func Delete(store *Record) (err error)

func Export

func Export(filename string) error

func Flush

func Flush()

func GetStores

func GetStores() map[uint64]*Record

func Import

func Import(filename string) error

func Lock

func Lock()

func Setup

func Setup() (created bool, err error)

func ToID

func ToID(value string) (id uint64, err error)

func Unlock

func Unlock()

Types

type Index

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

func LoadIndex

func LoadIndex(path string) (i *Index, err error)

func (*Index) Add

func (i *Index) Add(r *Record)

func (*Index) Del

func (i *Index) Del(id uint64) *Record

func (*Index) Flush

func (i *Index) Flush()

func (*Index) Get

func (i *Index) Get(id uint64) *Record

func (*Index) Lock

func (i *Index) Lock() error

func (*Index) NumRecords

func (i *Index) NumRecords() int

func (*Index) Path

func (i *Index) Path() string

func (*Index) Records

func (i *Index) Records() map[uint64]*Record

func (*Index) Unlock

func (i *Index) Unlock() error

type Meta

type Meta struct {
	Id         uint64    `json:"id"`
	Title      string    `json:"title"`
	Encryption string    `json:"encryption"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	ExpiredAt  time.Time `json:"expired_at"`
	Prune      bool      `json:"prune"`
	Notified   bool      `json:"notified"`
	Compressed bool      `json:"compressed"`
	Pinned     bool      `json:"pinned"`
	Size       uint64    `json:"size"`
	NextId     uint64    `json:"next_id"`
	// contains filtered or unexported fields
}

func Create

func Create(meta *Meta) (*Meta, error)

func CreateMeta

func CreateMeta(path string, values *Meta) (meta *Meta, err error)

func GetRecordMeta

func GetRecordMeta(store_id, record_id string) (meta *Meta, err error)

func OpenMeta

func OpenMeta(path string) (meta *Meta, err error)

func Records

func Records(store_id string) (records []*Meta, err error)

func Stores

func Stores() (stores []*Meta, err error)

func (*Meta) Close

func (m *Meta) Close()

func (*Meta) Flush

func (m *Meta) Flush() error

func (*Meta) FlushNoLock

func (m *Meta) FlushNoLock() error

func (*Meta) Lock

func (m *Meta) Lock() error

func (*Meta) SetPath

func (m *Meta) SetPath(path string) error

func (*Meta) Unlock

func (m *Meta) Unlock() error

func (*Meta) Update

func (m *Meta) Update(values *Meta) (err error)

type Record

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

func CreateRecord

func CreateRecord(root_path string, meta *Meta, reader *io.Reader) (record *Record, err error)

func GetRecord

func GetRecord(store_id, record_id string) (record *Record, err error)

func GetStore

func GetStore(store_id string) (store *Record, err error)

func OpenRecord

func OpenRecord(path string) (record *Record, err error)

func PrunableRecords

func PrunableRecords() (records []*Record, err error)

func (*Record) Children

func (r *Record) Children() map[uint64]*Record

func (*Record) Close

func (r *Record) Close()

func (*Record) DataPath

func (r *Record) DataPath() string

func (*Record) Del

func (r *Record) Del(id uint64) (deleted *Record, err error)

func (*Record) Delete

func (r *Record) Delete() error

func (*Record) Encryption

func (r *Record) Encryption() string

func (*Record) Expired

func (r *Record) Expired() bool

func (*Record) Expires

func (r *Record) Expires() bool

func (*Record) Get

func (r *Record) Get(id uint64) *Record

func (*Record) Id

func (r *Record) Id() uint64

func (*Record) Lock

func (r *Record) Lock() error

func (*Record) MarkUpdated

func (r *Record) MarkUpdated()

func (*Record) Meta

func (r *Record) Meta() *Meta

func (*Record) New

func (r *Record) New(meta *Meta, reader io.Reader) (child *Record, err error)

func (*Record) NumChildren

func (r *Record) NumChildren() int

func (*Record) SetNotified

func (r *Record) SetNotified(notified bool)

func (*Record) Size

func (r *Record) Size() uint64

func (*Record) Unlock

func (r *Record) Unlock() error

func (*Record) Update

func (r *Record) Update(meta *Meta) (err error)

func (*Record) UpdateBuffer

func (r *Record) UpdateBuffer(reader io.Reader) (err error)

func (*Record) WasNotified

func (r *Record) WasNotified() bool

Jump to

Keyboard shortcuts

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