testingutil

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDBIfNotExists

func GenerateDBIfNotExists(tb testing.TB, path string, size int64)

func GenerateDBIfNotExistsBytes

func GenerateDBIfNotExistsBytes(tb testing.TB, path string, size int64) []byte

func GenerateDBIfNotExistsReader

func GenerateDBIfNotExistsReader(tb testing.TB, path string, size int64) io.Reader

Types

type Client

type Client struct {
	AuthToken  string
	Cluster    string
	ClusterID  string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client implements the LiteFS Cloud HTTP API client.

func NewClient

func NewClient(u url.URL) (*Client, error)

NewClient returns a new instance of the client.

func (*Client) PosMap

func (c *Client) PosMap(ctx context.Context) (map[string]ltx.Pos, error)

PosMap returns the replication position for all databases on the backup service.

func (*Client) WriteTx

func (c *Client) WriteTx(ctx context.Context, name string, r io.Reader) error

WriteTx writes an LTX file to the backup service. The file must be contiguous with the latest LTX file on the backup service or else it will return an ltx.PosMismatchError.

type ResumableReader

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

func NewResumableReader

func NewResumableReader() *ResumableReader

func (*ResumableReader) Read

func (r *ResumableReader) Read(p []byte) (int, error)

func (*ResumableReader) Reading

func (r *ResumableReader) Reading() <-chan struct{}

Reading returns a channel that sends a value when the Read() function is called. Resume must be called after this to resume the Read().

func (*ResumableReader) Resume

func (r *ResumableReader) Resume(err error)

Resume should be called after Reading() is signaled. The err value will be returned by the paused Read() call.

type StatefulBlob

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

StatefulBlob represents a binary blob that LTX changesets can be generated from.

func NewStatefulBlob

func NewStatefulBlob(seed int64, pageSize uint32) *StatefulBlob

NewStatefulBlob returns a zero-length StatefulBlob.

func (*StatefulBlob) Clone

func (b *StatefulBlob) Clone() *StatefulBlob

Clone returns a copy of the entire state of the blob with a new PRNG.

func (*StatefulBlob) Commit

func (b *StatefulBlob) Commit() uint32

Commit returns the number of pages in the blob.

func (*StatefulBlob) Extend

func (b *StatefulBlob) Extend(tb testing.TB, n int64) io.Reader

Extend adds pages to change b to the given size. Fatal if n is less than len. Returns a reader of LTX data with the changes.

func (*StatefulBlob) Pos

func (b *StatefulBlob) Pos() ltx.Pos

Pos returns the current replication position.

Jump to

Keyboard shortcuts

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