textile

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package textile uses Textileio ThreadsDB to implement the github.com/google/note-maps/note interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultNetwork

func DefaultNetwork(dir string) (app.Net, error)

DefaultNetwork is a convenience function to build a github.com/textileio/core/app.Net for use with Open().

Types

type Database

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

Database is meant to implement the note.IsolatedReadWriteCloser interface.

func Open

func Open(ctx context.Context, n app.Net, opts ...Option) (*Database, error)

Open creates a Database that replicates through net n.

All options are optional, but if non are provided the database may not be reusable.

func (*Database) Close

func (x *Database) Close() error

func (*Database) GetThreadID

func (x *Database) GetThreadID() thread.ID

func (*Database) IsolatedRead

func (x *Database) IsolatedRead(f func(r note.FindLoader) error) error

func (*Database) IsolatedWrite

func (x *Database) IsolatedWrite(f func(rw note.FindLoadPatcher) error) error

type GetSecret

type GetSecret func(key string) (secret []byte, err error)

type Option

type Option func(*Options)

func WithBaseDirectory

func WithBaseDirectory(d string) Option

func WithGetSecret

func WithGetSecret(f GetSecret) Option

func WithPath

func WithPath(p string) Option

func WithSetSecret

func WithSetSecret(f SetSecret) Option

func WithThread

func WithThread(t string) Option

type Options

type Options struct {
	// BaseDirectory is a directory within which many databases might stored.
	//
	// It might typically be something like "$XDG_DATA_HOME/$argv[0]"
	BaseDirectory string

	// Thread is a printable multibase representation of the thread identifier.
	Thread string

	// Key is a printable representation of the thread encryption keys for
	// service/replication and, optionally, for reading.
	Key string

	// GetSecret will be used to load the thread encryption keys if none are
	// provided in the Key field.
	GetSecret

	// SetSecret will be used to store the thread encyrption keys.
	SetSecret
}

type SetSecret

type SetSecret func(key string, secret []byte) error

Jump to

Keyboard shortcuts

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