sharedobjcat

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(fs vfs.FS, dirname string) (*Catalog, CatalogContents, error)

Open creates a Catalog and loads any existing catalog file, returning the creator ID (if it is set) and the contents.

Types

type Batch

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

Batch is used to perform multiple object additions/deletions at once.

func (*Batch) AddObject

func (b *Batch) AddObject(meta SharedObjectMetadata)

AddObject adds a new object to the batch.

The given FileNum must be new - it must not match that of any object that was ever in the catalog.

func (*Batch) Append

func (b *Batch) Append(other Batch)

Append merges two batches.

func (*Batch) Copy

func (b *Batch) Copy() Batch

Copy returns a copy of the Batch.

func (*Batch) DeleteObject

func (b *Batch) DeleteObject(fileNum base.FileNum)

DeleteObject adds an object removal to the batch.

func (*Batch) IsEmpty

func (b *Batch) IsEmpty() bool

IsEmpty returns true if the batch is empty.

func (*Batch) Reset

func (b *Batch) Reset()

Reset clears the batch.

type Catalog

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

Catalog is used to manage the on-disk shared object catalog.

The catalog file is a log of records, where each record is an encoded versionEdit.

func (*Catalog) ApplyBatch

func (c *Catalog) ApplyBatch(b Batch) error

ApplyBatch applies a batch of updates; returns after the change is stably recorded on storage.

func (*Catalog) Close

func (c *Catalog) Close() error

Close any open files.

func (*Catalog) SetCreatorID

func (c *Catalog) SetCreatorID(id CreatorID) error

SetCreatorID sets the creator ID. If it is already set, it must match.

type CatalogContents

type CatalogContents struct {
	// CreatorID, if it is set.
	CreatorID CreatorID
	Objects   []SharedObjectMetadata
}

CatalogContents contains the shared objects in the catalog.

type CreatorID

type CreatorID uint64

CreatorID identifies the DB instance that originally created a shared object. This ID is incorporated in backing object names. Must be non-zero.

func (CreatorID) IsSet

func (c CreatorID) IsSet() bool

IsSet returns true if the CreatorID is not zero.

func (CreatorID) String

func (c CreatorID) String() string

type SharedObjectMetadata

type SharedObjectMetadata struct {
	// FileNum is the identifier for the object within the context of a single DB
	// instance.
	FileNum base.FileNum
	// FileType is the type of the object. Only certain FileTypes are possible.
	FileType base.FileType
	// CreatorID identifies the DB instance that originally created the object.
	CreatorID CreatorID
	// CreatorFileNum is the identifier for the object within the context of the
	// DB instance that originally created the object.
	CreatorFileNum base.FileNum
}

SharedObjectMetadata encapsulates the data stored in the catalog file for each object.

Jump to

Keyboard shortcuts

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