Documentation
¶
Overview ¶
Package volume_idb implements the browser volume engines' storage primitives on IndexedDB: a chunked device.Device and a records.Store.
Every call is one IndexedDB transaction. A call issues all of its requests in one JavaScript task and returns on the transaction's complete event, so the Go code blocks only once per call.
Index ¶
- Constants
- func DeleteDatabase(name string) error
- type Device
- func (d *Device) Close() error
- func (d *Device) List(ctx context.Context) ([]device.File, error)
- func (d *Device) Read(ctx context.Context, reads []device.Read) error
- func (d *Device) Remove(ctx context.Context, names []string) error
- func (d *Device) Truncate(ctx context.Context, name string, size int64) error
- func (d *Device) Write(ctx context.Context, writes []device.Write, flush bool) error
- type Store
- func (s *Store) Close() error
- func (s *Store) Commit(ctx context.Context, ops []records.Op, durable bool) error
- func (s *Store) Get(ctx context.Context, keys [][]byte) ([][]byte, error)
- func (s *Store) Has(ctx context.Context, keys [][]byte) ([]bool, error)
- func (s *Store) Scan(ctx context.Context, prefix []byte, fn func(key, value []byte) error) error
Constants ¶
const ChunkSize = 64 << 10
ChunkSize is the length of a full chunk.
Variables ¶
This section is empty.
Functions ¶
func DeleteDatabase ¶
DeleteDatabase deletes the database name. A missing database is not an error.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is a device.Device on one IndexedDB database. It is the database's only writer, enforced by an exclusive Web Lock held from OpenDevice until Close: it holds the file lengths and the last chunk written to each file, so appends need no read.
func OpenDevice ¶
OpenDevice opens the device database name, creating it when absent. It returns device.ErrHeld while another Device in the origin has name open.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a records.Store on one IndexedDB database.