package datakit
import "github.com/moby/datakit/api/go-datakit"
The datakit package contains common patterns over 9P, which avoids the need for applications to use 9P directly.
Index ¶
- Variables
- func Head(ctx context.Context, client *Client, fromBranch string) (string, error)
- func NewTransaction(ctx context.Context, client *Client, fromBranch string) (*transaction, error)
- type BoolField
- type Client
- func Dial(ctx context.Context, network, address string) (*Client, error)
- func NewClient(ctx context.Context, conn net.Conn) (*Client, error)
- func (c *Client) Close(ctx context.Context)
- func (c *Client) Create(ctx context.Context, path ...string) (*File, error)
- func (c *Client) List(ctx context.Context, path []string) ([]string, error)
- func (c *Client) Mkdir(ctx context.Context, path ...string) error
- func (c *Client) Open(ctx context.Context, mode p9p.Flag, path ...string) (*File, error)
- func (c *Client) Remove(ctx context.Context, path ...string) error
- type File
- func (f *File) Close(ctx context.Context)
- func (f *File) NewFileReader(ctx context.Context) *FileReader
- func (f *File) NewIOReader(ctx context.Context, offset int64) io.Reader
- func (f *File) NewIOWriter(ctx context.Context, offset int64) io.Writer
- func (f *File) Read(ctx context.Context, p []byte, offset int64) (int, error)
- func (f *File) Write(ctx context.Context, p []byte, offset int64) (int, error)
- type FileReader
- type IntField
- type Record
- func NewRecord(ctx context.Context, client *Client, lookupB []string, defaultsB string, stateB string, path []string) (*Record, error)
- func (f *Record) BoolField(key string, value bool) *BoolField
- func (f *Record) IntField(key string, value int) *IntField
- func (r *Record) Seal(ctx context.Context) error
- func (r *Record) SetMultiple(description string, fields []*StringField, values []string) error
- func (f *Record) StringField(key string, value string) *StringField
- func (f *Record) StringRefField(key string, value *string) *StringRefField
- func (r *Record) Upgrade(ctx context.Context, schemaVersion int) error
- func (r *Record) Wait(ctx context.Context) error
- type Snapshot
- func NewSnapshot(ctx context.Context, client *Client, kind SnapshotKind, thing string) *Snapshot
- func (s *Snapshot) List(ctx context.Context, path []string) ([]string, error)
- func (s *Snapshot) Read(ctx context.Context, path []string) (string, error)
- type SnapshotKind
- type StringField
- func (f *StringField) Get() (string, Version)
- func (f *StringField) HasChanged(version Version) bool
- func (f *StringField) Set(description string, value string) error
- type StringRefField
- func (f *StringRefField) Get() (*string, Version)
- func (f *StringRefField) HasChanged(version Version) bool
- func (f *StringRefField) Set(description string, value *string) error
- type Version
- type Watch
Variables ¶
var InitialVersion = Version(0)
Functions ¶
func Head ¶
Head retrieves the commit sha of the given branch
func NewTransaction ¶
NewTransaction opens a new transaction originating from fromBranch, named newBranch.
Types ¶
type BoolField ¶
type BoolField struct {
// contains filtered or unexported fields
}
func (*BoolField) Get ¶
Get retrieves the current value of the key
func (*BoolField) HasChanged ¶
HasChanged returns true if the key has changed since the given version
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func Dial ¶
Dial opens a connection to a 9P server
func NewClient ¶
NewClient creates opens a connection with the p9p server
func (*Client) Close ¶
func (*Client) Create ¶
Create creates a file
func (*Client) List ¶
List a directory
func (*Client) Mkdir ¶
Mkdir acts like 'mkdir -p'
func (*Client) Open ¶
Open opens a file
func (*Client) Remove ¶
Remove acts like 'rm -f'
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Close ¶
Close closes a file
func (*File) NewFileReader ¶
func (f *File) NewFileReader(ctx context.Context) *FileReader
func (*File) NewIOReader ¶
NewIOReader creates a standard io.Reader at a given position in the file
func (*File) NewIOWriter ¶
NewIOWriter creates a standard io.Writer at a given position in the file
func (*File) Read ¶
Read reads a value
func (*File) Write ¶
Write writes a value
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func (*FileReader) Read ¶
func (f *FileReader) Read(p []byte) (int, error)
type IntField ¶
type IntField struct {
// contains filtered or unexported fields
}
func (*IntField) Get ¶
Get retrieves the current value of the key
func (*IntField) HasChanged ¶
HasChanged returns true if the key has changed since the given version
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
Record is a typed view on top of a database branch
func NewRecord ¶
func NewRecord(ctx context.Context, client *Client, lookupB []string, defaultsB string, stateB string, path []string) (*Record, error)
func (*Record) BoolField ¶
BoolField defines an boolean option with a specified key and default value
func (*Record) IntField ¶
IntField defines an boolean option with a specified key and default value
func (*Record) Seal ¶
func (*Record) SetMultiple ¶
func (r *Record) SetMultiple(description string, fields []*StringField, values []string) error
func (*Record) StringField ¶
func (f *Record) StringField(key string, value string) *StringField
StringField defines a string
func (*Record) StringRefField ¶
func (f *Record) StringRefField(key string, value *string) *StringRefField
StringRefField defines a string option which can be nil with a specified key and default value
func (*Record) Upgrade ¶
func (*Record) Wait ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func NewSnapshot ¶
NewSnapshot opens a new snapshot referencing the given object.
func (*Snapshot) List ¶
List returns filenames list in directory
func (*Snapshot) Read ¶
Read reads a value from the snapshot
type SnapshotKind ¶
type SnapshotKind uint8
const ( COMMIT SnapshotKind = 0x01 // from a commit hash OBJECT SnapshotKind = 0x02 // from an object hash )
type StringField ¶
type StringField struct {
// contains filtered or unexported fields
}
func (*StringField) Get ¶
func (f *StringField) Get() (string, Version)
Get retrieves the current value of the key
func (*StringField) HasChanged ¶
func (f *StringField) HasChanged(version Version) bool
HasChanged returns true if the key has changed since the given version
func (*StringField) Set ¶
func (f *StringField) Set(description string, value string) error
Set unconditionally sets the value of the key
type StringRefField ¶
type StringRefField struct {
// contains filtered or unexported fields
}
func (*StringRefField) Get ¶
func (f *StringRefField) Get() (*string, Version)
Get retrieves the current value of the key
func (*StringRefField) HasChanged ¶
func (f *StringRefField) HasChanged(version Version) bool
HasChanged returns true if the key has changed since the given version
func (*StringRefField) Set ¶
func (f *StringRefField) Set(description string, value *string) error
Set unconditionally sets the value of the key
type Version ¶
type Version int
type Watch ¶
type Watch struct {
// contains filtered or unexported fields
}
func NewWatch ¶
func NewWatch(ctx context.Context, client *Client, fromBranch string, path []string) (*Watch, error)
NewWatch starts watching a path within a branch
func (*Watch) Close ¶
func (*Watch) Next ¶
Source Files ¶
client.go config.go doc.go snapshot.go transaction.go watch.go
- Version
- v1.0.0 (latest)
- Published
- Jul 12, 2019
- Platform
- js/wasm
- Imports
- 11 packages
- Last checked
- now –
Tools for package owners.