inmem

package
v0.0.0-...-7d62c13 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

This section is empty.

Types

type Option

type Option func(*Store)

type Store

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

func New

func New(opts ...Option) *Store

New creates a new Store with the given options.

func (*Store) CreateRevision

func (s *Store) CreateRevision(filepath string, r io.Reader) (int64, string, error)

CreateRevision creates a new revision of the file at the given path. The file contains meta information about the revisions. The revisions are stores in the /.revisions directory. Ex:

"/tmp/test.txt" -> "/tmp/test.txt

func (*Store) GetRevision

func (s *Store) GetRevision(filepath, revID string) (fs.File, error)

func (*Store) ListEntries

func (s *Store) ListEntries(path string) ([]string, error)

ListEntries returns a list of entries in the given path. If the entry is a file, the list item will contain the file name and the latest revision ID. If the entry is a directory, the list item will contain the directory name followed by a space and the string "DIR". Ex:

"/tmp" -> ["dirA/ DIR", "test.txt r2"]

Jump to

Keyboard shortcuts

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