db

package
v0.0.0-...-a449dc4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: BSD-2-Clause Imports: 19 Imported by: 0

README

Revision filesystem

A primitive (embeddable) database that stores everything on filesystem and applies Git-revisioning on it to keep track of changes.

How are files stored? TOML (humanfriendly textfiles)

Documentation

Overview

Package db implements a very simple filesystem abstraction to save all as toml and instruct Git to commit/push.

Index

Constants

View Source
const DEADLINE = "5s"
View Source
const MAX_FILES = 1000

Variables

View Source
var (
	Repo            *git.Repository
	Path            string
	AlwaysLowercase bool // Force disk I/O in lowercase for better OSX compatibility

)

Functions

func Init

func Init(path string) error

func Update

func Update(change Commit, fn Fn) error

func View

func View(fn Fn) error

Types

type Commit

type Commit struct {
	Name    string
	Email   string
	Message string
}

type CommitMessage

type CommitMessage struct {
	*object.Commit
}

type Fn

type Fn func(*Txn) error

type Pagination

type Pagination struct {
	From  int // TODO: possible?
	Count int
}

type PaginationHeader

type PaginationHeader struct {
	Total int
}

type Txn

type Txn struct {
	Write bool // Don't toggle this bool but use the Update instead of View-func
}

func (*Txn) List

func (t *Txn) List(path []string, p Pagination, mem interface{}, f func(string, string, string) error) (PaginationHeader, error)

func (*Txn) Logs

func (t *Txn) Logs(limit int, fn func(c *CommitMessage) error) error

func (*Txn) Move

func (t *Txn) Move(from, to string) error

func (*Txn) Open

func (t *Txn) Open(path string, out interface{}) error

func (*Txn) OpenFirst

func (t *Txn) OpenFirst(paths []string, out interface{}) error

func (*Txn) OpenRaw

func (t *Txn) OpenRaw(path string) (io.ReadCloser, error)

func (*Txn) RawList

func (t *Txn) RawList(path string) ([]fs.FileInfo, error)

func (*Txn) Remove

func (t *Txn) Remove(path string) error

func (*Txn) Save

func (t *Txn) Save(file string, isNew bool, in interface{}) error

Jump to

Keyboard shortcuts

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