database

package
v0.0.0-...-e093297 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func Init

func Init(path string) (result *DB, err error)

Init opens and connects to the database.

func (*DB) Add

func (db *DB) Add(input Node) (err error)

Add inserts a File entry into the database if it doesn't exist already.

func (*DB) Get

func (db *DB) Get(path string) (result Node, err error)

Get searches for and returns a the corresponding entry from the database if the entry exists.

func (*DB) GetAll

func (db *DB) GetAll(limit, page int) (result []Node, err error)

func (*DB) GetAllOlderThan

func (db *DB) GetAllOlderThan(age time.Time, limit, page int) (result []Node, err error)

func (*DB) GetChildren

func (db *DB) GetChildren(parentPath string, limit, page int) (result []Node, err error)

func (*DB) Remove

func (db *DB) Remove(path string) (result Node, err error)

Remove deletes and returns an entry from the database.

func (*DB) Update

func (db *DB) Update(entry Node) (old Node, err error)

Update attempts to modify an existing entry in the database.

type Node

type Node struct {
	Path         string
	Name         string
	Type         string
	Size         int64
	CID          string
	Parent       string
	Modified     time.Time
	Replications int
}

Jump to

Keyboard shortcuts

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