object

package
v0.0.0-...-20d847b Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDownloaderServer

func NewDownloaderServer(downloader Downloader[GlobalReference]) object.DownloaderServer

NewDownloaderServer creates a gRPC server object for exposing a Downloader. This can be used to make objects contained in an object store accessible via the network.

func NewUploaderServer

func NewUploaderServer(uploader Uploader[GlobalReference, []byte]) object.UploaderServer

NewUploaderServer creates a gRPC server object for exposing an Uploader. This can be used to make objects contained in an object store accessible via the network.

Types

type Contents

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

func MustNewContents

func MustNewContents(referenceFormatValue object.ReferenceFormat_Value, references []LocalReference, payload []byte) *Contents

func NewContentsFromFullData

func NewContentsFromFullData(reference LocalReference, data []byte) (*Contents, error)

func NewContentsFromProto

func NewContentsFromProto(reference LocalReference, m *object.Contents) (*Contents, error)

func (*Contents) Flatten

func (c *Contents) Flatten() *Contents

func (*Contents) GetDegree

func (c *Contents) GetDegree() int

func (*Contents) GetFullData

func (c *Contents) GetFullData() []byte

func (*Contents) GetOutgoingReference

func (c *Contents) GetOutgoingReference(i int) LocalReference

func (*Contents) GetOutgoingReferencesList

func (c *Contents) GetOutgoingReferencesList() OutgoingReferencesList

func (*Contents) GetPayload

func (c *Contents) GetPayload() []byte

func (*Contents) GetReference

func (c *Contents) GetReference() LocalReference

func (*Contents) ToProto

func (c *Contents) ToProto() *object.Contents

func (*Contents) Unflatten

func (c *Contents) Unflatten(newReference LocalReference) (*Contents, error)

type Downloader

type Downloader[TReference any] interface {
	DownloadObject(ctx context.Context, reference TReference) (*Contents, error)
}

type DownloaderForTesting

type DownloaderForTesting Downloader[GlobalReference]

type GlobalReference

type GlobalReference struct {
	InstanceName
	LocalReference
}

func MustNewSHA256V1GlobalReference

func MustNewSHA256V1GlobalReference(instanceName, hash string, sizeBytes uint32, height uint8, degree uint16, maximumTotalParentsSizeBytes uint64) GlobalReference

func (GlobalReference) CompareByHeight

func (r GlobalReference) CompareByHeight(other GlobalReference) int

func (GlobalReference) Flatten

func (r GlobalReference) Flatten() GlobalReference

func (GlobalReference) GetNamespace

func (r GlobalReference) GetNamespace() Namespace

func (*GlobalReference) SetLocalReference

func (r *GlobalReference) SetLocalReference(localReference LocalReference)

func (GlobalReference) WithLocalReference

func (r GlobalReference) WithLocalReference(localReference LocalReference) GlobalReference

type InstanceName

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

func NewInstanceName

func NewInstanceName(value string) InstanceName

func (InstanceName) WithLocalReference

func (in InstanceName) WithLocalReference(localReference LocalReference) GlobalReference

type Limit

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

func NewLimit

func NewLimit(m *object.Limit) Limit

func (*Limit) AcquireObjectAndChildren

func (l *Limit) AcquireObjectAndChildren(reference LocalReference) bool

func (*Limit) CanAcquireObjectAndChildren

func (l *Limit) CanAcquireObjectAndChildren(reference LocalReference) bool

func (Limit) Min

func (l Limit) Min(other Limit) Limit

func (*Limit) ReleaseChildren

func (l *Limit) ReleaseChildren(reference LocalReference)

func (*Limit) ReleaseObject

func (l *Limit) ReleaseObject(reference LocalReference)

func (Limit) ToProto

func (l Limit) ToProto() *object.Limit

type LocalReference

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

func MustNewSHA256V1LocalReference

func MustNewSHA256V1LocalReference(hash string, sizeBytes uint32, height uint8, degree uint16, maximumTotalParentsSizeBytes uint64) LocalReference

func (LocalReference) CompareByHeight

func (r LocalReference) CompareByHeight(other LocalReference) int

CompareByHeight returns -1 if the reference comes before another reference along a total order based on the references' height and maximum total parents size. Conversely, it returns 1 if the reference comes after another reference. 0 is returned if both references are equal.

This order can be used to perform bounded parallel traversal of DAGs in such a way that forward progress is guaranteed.

func (LocalReference) Flatten

func (r LocalReference) Flatten() (flatReference LocalReference)

func (LocalReference) GetDegree

func (r LocalReference) GetDegree() int

func (LocalReference) GetHash

func (r LocalReference) GetHash() []byte

func (LocalReference) GetHeight

func (r LocalReference) GetHeight() int

func (LocalReference) GetLocalReference

func (r LocalReference) GetLocalReference() LocalReference

func (LocalReference) GetMaximumTotalParentsSizeBytes

func (r LocalReference) GetMaximumTotalParentsSizeBytes(includeSelf bool) int

func (LocalReference) GetRawReference

func (r LocalReference) GetRawReference() []byte

func (LocalReference) GetReferenceFormat

func (LocalReference) GetReferenceFormat() ReferenceFormat

func (LocalReference) GetSizeBytes

func (r LocalReference) GetSizeBytes() int

func (LocalReference) String

func (r LocalReference) String() string

func (LocalReference) WithLocalReference

func (r LocalReference) WithLocalReference(localReference LocalReference) LocalReference

type Namespace

type Namespace struct {
	InstanceName
	ReferenceFormat
}

func MustNewNamespace

func MustNewNamespace(namespaceMessage *object.Namespace) Namespace

func NewNamespace

func NewNamespace(namespaceMessage *object.Namespace) (Namespace, error)

func (Namespace) NewGlobalReference

func (ns Namespace) NewGlobalReference(rawReference []byte) (GlobalReference, error)

func (Namespace) ToProto

func (ns Namespace) ToProto() *object.Namespace

type OutgoingReferences

type OutgoingReferences interface {
	GetDegree() int
	GetOutgoingReference(index int) LocalReference
	GetOutgoingReferencesList() OutgoingReferencesList
}

OutgoingReferences is a list of outgoing references of an object. It may either be implemented by a simple slice, or it's possible to provide an implementation that reads references directly out of the object's contents.

type OutgoingReferencesList

type OutgoingReferencesList []LocalReference

OutgoingReferencesList is a list of outgoing references of an object that is backed by a simple slice.

func (OutgoingReferencesList) GetDegree

func (l OutgoingReferencesList) GetDegree() int

func (OutgoingReferencesList) GetOutgoingReference

func (l OutgoingReferencesList) GetOutgoingReference(index int) LocalReference

func (OutgoingReferencesList) GetOutgoingReferencesList

func (l OutgoingReferencesList) GetOutgoingReferencesList() OutgoingReferencesList

type ReferenceFormat

type ReferenceFormat struct{}

func MustNewReferenceFormat

func MustNewReferenceFormat(value object.ReferenceFormat_Value) ReferenceFormat

func NewReferenceFormat

func NewReferenceFormat(value object.ReferenceFormat_Value) (ReferenceFormat, error)

func (ReferenceFormat) GetBogusReference

func (ReferenceFormat) GetBogusReference() LocalReference

GetBogusReference returns a reference that is valid according to all of the range restrictions of the reference format, but for which it's impossible to ever construct valid object contents.

This function can be used to simulate the creation of messages, without actually computing their contents and references.

func (ReferenceFormat) GetMaximumObjectSizeBytes

func (ReferenceFormat) GetMaximumObjectSizeBytes() int

func (ReferenceFormat) GetReferenceSizeBytes

func (ReferenceFormat) GetReferenceSizeBytes() int

func (ReferenceFormat) NewContents

func (rf ReferenceFormat) NewContents(outgoingReferences []LocalReference, payload []byte) (*Contents, error)

func (ReferenceFormat) NewLocalReference

func (ReferenceFormat) NewLocalReference(rawReference []byte) (r LocalReference, err error)

func (ReferenceFormat) ToProto

type Store

type Store[TReference any, TLease any] interface {
	Downloader[TReference]
	Uploader[TReference, TLease]
}

func NewStore

func NewStore[TReference, TLease any](downloader Downloader[TReference], uploader Uploader[TReference, TLease]) Store[TReference, TLease]

NewStore is a helper function for creating a Store that is backed by separate instances of Downloader and Uploader.

type StoreForTesting

type StoreForTesting Store[GlobalReference, any]

type UploadObjectComplete

type UploadObjectComplete[TLease any] struct {
	Lease TLease
}

type UploadObjectIncomplete

type UploadObjectIncomplete[TLease any] struct {
	Contents                     *Contents
	WantOutgoingReferencesLeases []int
}

type UploadObjectMissing

type UploadObjectMissing[TLease any] struct{}

type UploadObjectResult

type UploadObjectResult[TLease any] interface {
	// contains filtered or unexported methods
}

type Uploader

type Uploader[TReference any, TLease any] interface {
	UploadObject(ctx context.Context, reference TReference, contents *Contents, childrenLeases []TLease, wantContentsIfIncomplete bool) (UploadObjectResult[TLease], error)
}

type UploaderForTesting

type UploaderForTesting Uploader[GlobalReference, any]

type UploaderForTestingBytes

type UploaderForTestingBytes Uploader[GlobalReference, []byte]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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