Documentation ¶
Index ¶
- func TempFile(dir, prefix string, suffix string) (f *os.File, err error)
- type DataStore
- type FileStore
- func (fs FileStore) ListEntries(prefix string) ([]string, error)
- func (fs FileStore) NewEntryReadCloser(uid string) (io.ReadCloser, error)
- func (fs FileStore) NewEntryWriteCloser(uid string) (io.WriteCloser, error)
- func (fs FileStore) Remove(uid string) error
- func (fs FileStore) Rename(srcUID, destUID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TempFile ¶
TempFile creates a new temporary file in the directory dir with a name beginning with prefix and ending in suffix, opens the file for reading and writing, and returns the resulting *os.File. TempFile is a modified version of ioutil's TempFile that supports suffixes and uses a naive increment strategy, instead of random numbers, for uniqueness.
Types ¶
type DataStore ¶
type DataStore interface { ListEntries(string) ([]string, error) NewEntryWriteCloser(string) (io.WriteCloser, error) NewEntryReadCloser(string) (io.ReadCloser, error) RemoveEntry(string) error MoveEntry(string, string) error }
DataStore represents a persistent data store for notebooks.
type FileStore ¶
type FileStore struct {
Dir string
}
FileStore implements DataStore using files and directories. Notebooks and sections within a notebook are represented by directories. Entries are represented by files.
func (FileStore) ListEntries ¶
ListEntries returns the UIDs of each entry in the FileStore.
func (FileStore) NewEntryReadCloser ¶
func (fs FileStore) NewEntryReadCloser(uid string) (io.ReadCloser, error)
NewEntryReadCloser opens an entry's underlying file and returns an io.ReadCloser.
func (FileStore) NewEntryWriteCloser ¶
func (fs FileStore) NewEntryWriteCloser(uid string) (io.WriteCloser, error)
NewEntryWriteCloser opens or creates an entry's underlying file and returns an io.WriteCloser.