Documentation
¶
Overview ¶
Package notes provides types and functions for interacting with a note maps data storage system.
Package notes provides types and functions for interacting with a note maps data storage system.
Package notes provides types and functions for interacting with a note maps data storage system.
Package notes provides types and functions for interacting with a note maps data storage system.
Index ¶
- Constants
- func DebugDiff(a, b Note) (string, interface{}, interface{}, error)
- func Equal(a, b Note) (bool, error)
- type AddContent
- type EmptyNote
- type Error
- type FindLoadPatcher
- type FindLoader
- type Finder
- type ID
- type IsolatedReadWriteCloser
- type IsolatedReader
- type IsolatedWriter
- type Loader
- type Note
- type Operation
- type Patcher
- type Query
- type SetValue
- type Stage
- type StageNote
Constants ¶
const ( // EmptyLoader implements the Loader interface for a note map that is // always empty. EmptyLoader emptyLoader = 0 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddContent ¶ added in v0.0.3
func (AddContent) AffectsID ¶ added in v0.0.3
func (x AddContent) AffectsID(id ID) bool
type EmptyNote ¶
type EmptyNote ID
EmptyNote is simply an empty Note with nothing more than an ID.
func (EmptyNote) GetContents ¶
type FindLoadPatcher ¶ added in v0.0.3
FindLoadPatcher combines the Finder, Loader, and Patcher interfaces.
type FindLoader ¶ added in v0.0.3
FindLoader combines the Finder and Loader interfaces.
type Finder ¶
Finder can be implemented to support finding notes in a note map according to a query.
type ID ¶ added in v0.0.3
type ID string
ID is the type of values that identify notes.
const EmptyID ID = ""
EmptyID is the zero or nil value for note identifiers, and never identifies a valid note.
EmptyID exists only to make code that specifies the zero value for Note identifiers a bit more readable.
type IsolatedReadWriteCloser ¶ added in v0.0.3
type IsolatedReadWriteCloser interface {
IsolatedReader
IsolatedWriter
io.Closer
}
IsolatedReadWriteCloser provides atomic isolated read and write operations over a note map.
An instance of IsolatedReadWriteCloser should be closed when it is no longer needed.
type IsolatedReader ¶ added in v0.0.3
type IsolatedReader interface {
// IsolatedRead invokes f with a FindLoader that will read from an
// unchanging version of the note map.
IsolatedRead(f func(r FindLoader) error) error
}
IsolatedReader provides isolated read operations over a note map.
type IsolatedWriter ¶ added in v0.0.3
type IsolatedWriter interface {
// IsolatedWrite invokes f with an isolated FindLoadPatcher that can read and
// change a note map.
//
// If f returns an error, none of the changes will be saved. Implementations
// should return an error in any case when changes are not saved.
IsolatedWrite(f func(rw FindLoadPatcher) error) error
}
IsolatedWriter provides atomic isolated write operations over a note map.
type Loader ¶
type Loader interface {
// Load returns a slice of all found notes.
//
// All notes exist implicitly, even if they are empty. An error indicates
// something actually went wrong.
Load(ids []ID) ([]Note, error)
}
Loader can be implemented to support loading notes by id.
type Note ¶
Note is a graph-like interface to a note in a note map.
Since traversing from note to note in a note map may require fragile operations like loading query results from a storage backend, most methods can return an error instead of the requested data.
type Patcher ¶
Patcher can be implemented to support making changes to notes in a note map by applying a set of differences to them.
type Query ¶
type Query struct {
}
Query limits the notes that will be found when loading information from a graph.
The default query matches all notes.
type Stage ¶
Stage describes a set of changes that might be made to a note map.
The default stage describes an empty set of changes to be made to an empty note map.
A default Stage{} is an empty set of changes made to an empty note map.
type StageNote ¶
StageNote supports updating the content of a note within a batch, and also implements the Note interface to read the hypothetical state of a note with the batch applied.
func (*StageNote) AddContent ¶
AddContent expands the staged operations to add content to this note.