storage

package
v0.0.0-...-1410e0b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Appendable

type Appendable interface {
	// Appender returns a new appender for the storage.
	Appender() Appender
}

type Appender

type Appender interface {

	// AppendResource adds a new copy for the given resource.
	AppendResource(urn string, t int64, content ResourceContent) error

	// AppendState adds a new value of the state for the given resource.
	AppendState(urn string, state string, t int64, value uint64) error

	// AppendRelation adds a new connection of the given resources.
	AppendRelation(name, srcRrn, targetUrn string, t int64, rs RelationSwitch) error

	// Commit submits the collected resources and purges the batch. If Commit
	// returns a non-nil error, it also rolls back all modifications made in
	// the appender so far, as Rollback would do. In any case, an Appender
	// must not be used anymore after Commit has been called.
	Commit() error

	// Rollback rolls back all modifications made in the appender so far.
	// Appender has to be discarded after rollback.
	Rollback() error
}

Appender provides batched appends against a storage. It must be completed with a call to Commit or Rollback and must not be reused afterwards. Operations on the Appender interface are not goroutine-safe.

type Attribute

type Attribute interface {
	// Name return the attribute name.
	Name() string
	// Records returns the complete set of resource attributes. Including the identifying of resource.
	Records() historical.RecordStrings
}

type AttributeSet

type AttributeSet interface {
	Next() bool
	At() Attribute
	// Err The error that iteration as failed with. When an error occurs, set cannot continue to iterate.
	Err() error
	// Warnings A collection of warnings for the whole set, could be return even iteration has not failed with error.
	Warnings() Warnings
}

type Querier

type Querier interface {

	// SelectResources return a set of Resources that matches the given ResourceSelector.
	// Caller can specify if it requires return resources to be sorted.
	SelectResources(sortResources bool, selectors ...model.ResourceSelector) ResourceRelationSet

	// SelectStates returns a set of resource state that matcher the given ResourceSelector.
	// Caller can specify if requires return states to be sorted
	SelectStates(sortStates bool, selectors ...model.StateSelector) StateSet
	// contains filtered or unexported methods
}

type Queryable

type Queryable interface {
	Querier(ctx context.Context, mint, maxt int64) (Querier, error)
}

type Relation

type Relation interface {
	Name() string
	Source() string
	Target() string
	Records() historical.TimePairs
}

type RelationSet

type RelationSet interface {
	Next() bool
	At() Relation
	Err() error
	Warning() Warnings
}

type RelationSwitch

type RelationSwitch int
const (
	RelationOn RelationSwitch = iota << 1
	RelationOff
)

type Resource

type Resource interface {
	Type() string
	Urn() string
	SecondaryTypes() []string
	CreatedAt() model.Time
	DeletedAt() model.Time
	Attributes() AttributeSet
	State() State
}

type ResourceContent

type ResourceContent interface {
	Type() string
	SecondaryTypes() []string
	Attributes() map[string]string
}

type ResourceRelationSet

type ResourceRelationSet interface {
	ResourceSet() ResourceSet
	RelationSet() RelationSet
}

type ResourceSet

type ResourceSet interface {
	Next() bool
	At() Resource
	// Err The error that iteration as failed with. When an error occurs, set cannot continue to iterate.
	Err() error
	// Warnings A collection of warnings for the whole set, could be return even iteration has not failed with error.
	Warnings() Warnings
}

type State

type State interface {
	Resource() string
	States() labels.Labels
	Name() string
	Records() historical.RecordNumber
}

type StateSet

type StateSet interface {
	Next() bool
	At() State
	// Err The error that iteration as failed with. When an error occurs, set cannot continue to iterate.
	Err() error
	// Warnings A collection of warnings for the whole set, could be return even iteration has not failed with error.
	Warnings() Warnings
}

type Warnings

type Warnings []error

Jump to

Keyboard shortcuts

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