fs

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2015 License: MIT, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package fs is a simple Datastore implementation that stores keys are directories and files, mirroring the key. That is, the key "/foo/bar" is stored as file "PATH/foo/bar/.dsobject".

This means key some segments will not work. For example, the following keys will result in unwanted behavior:

  • "/foo/./bar"
  • "/foo/../bar"
  • "/foo\x00bar"

Keys that only differ in case may be confused with each other on case insensitive file systems, for example in OS X.

This package is intended for exploratory use, where the user would examine the file system manually, and should only be used with human-friendly, trusted keys. You have been warned.

Index

Constants

This section is empty.

Variables

View Source
var ObjectKeySuffix = ".dsobject"

Functions

func NewDatastore

func NewDatastore(path string) (ds.Datastore, error)

NewDatastore returns a new fs Datastore at given `path`

Types

type Datastore

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

Datastore uses a uses a file per key to store values.

func (*Datastore) Delete

func (d *Datastore) Delete(key ds.Key) (err error)

Delete removes the value for given key

func (*Datastore) Get

func (d *Datastore) Get(key ds.Key) (value interface{}, err error)

Get returns the value for given key

func (*Datastore) Has

func (d *Datastore) Has(key ds.Key) (exists bool, err error)

Has returns whether the datastore has a value for a given key

func (*Datastore) KeyFilename

func (d *Datastore) KeyFilename(key ds.Key) string

KeyFilename returns the filename associated with `key`

func (*Datastore) Put

func (d *Datastore) Put(key ds.Key, value interface{}) (err error)

Put stores the given value.

func (*Datastore) Query

func (d *Datastore) Query(q query.Query) (query.Results, error)

Query implements Datastore.Query

Jump to

Keyboard shortcuts

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