inventory

package
v0.16.0-a2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapshotPayloadSchemaVersion  uint32 = 1
	EvidenceSectionProviderStatus        = "akash.provider.v1.Status"
)
View Source
const EvidenceSectionInventoryOperator = "akash.provider.inventory.operator.v1.Cluster"
View Source
const NonceSize = 32

Variables

This section is empty.

Functions

func HashPayload

func HashPayload(payload []byte) []byte

func MarshalDeterministic

func MarshalDeterministic(msg proto.Message) ([]byte, error)

func ResourceSummaryFromCluster

func ResourceSummaryFromCluster(
	cluster inventoryv1.Cluster,
	activeLeases uint32,
	softwareVersion string,
	softwareSignature []byte,
	softwareIdentity *inventoryv1.SoftwareIdentity,
) inventoryv1.SnapshotResourceSummary

func ValidateNonce

func ValidateNonce(nonce []byte) error

func ValidateSnapshot

func ValidateSnapshot(snapshot *Snapshot) error

func ValidateSnapshotRecord

func ValidateSnapshotRecord(record SnapshotRecord) error

Types

type Builder

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

func NewBuilder

func NewBuilder(payload PayloadSource, signer ptypes.ProviderSigner) (*Builder, error)

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, req SnapshotRequest) (*Snapshot, error)

func (*Builder) Provider

func (b *Builder) Provider() string

type Collector

type Collector interface {
	Name() string
	Collect(context.Context) (EvidenceSection, error)
}

type EvidenceSection

type EvidenceSection struct {
	Name    string
	Payload []byte
}

type MaterialPayloadSource

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

func (*MaterialPayloadSource) Payload

func (s *MaterialPayloadSource) Payload(ctx context.Context, req SnapshotRequest) ([]byte, error)

type MaterialPayloadSourceConfig

type MaterialPayloadSourceConfig struct {
	Source   SnapshotMaterialSource
	Provider string
	ChainID  string
	Now      func() time.Time
}

type MemorySnapshotStore

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

func NewMemorySnapshotStore

func NewMemorySnapshotStore() *MemorySnapshotStore

func (*MemorySnapshotStore) Get

func (s *MemorySnapshotStore) Get(_ context.Context, provider string, hash []byte) (SnapshotRecord, bool, error)

func (*MemorySnapshotStore) Latest

func (s *MemorySnapshotStore) Latest(_ context.Context, provider string) (SnapshotRecord, bool, error)

func (*MemorySnapshotStore) Put

type OperatorMaterialSource

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

func (*OperatorMaterialSource) SnapshotMaterial

func (s *OperatorMaterialSource) SnapshotMaterial(ctx context.Context) (SnapshotMaterial, error)

type OperatorMaterialSourceConfig

type OperatorMaterialSourceConfig struct {
	Inventory         cinventory.Client
	Status            StatusClient
	SoftwareVersion   string
	SoftwareSignature []byte
	SoftwareIdentity  *inventoryv1.SoftwareIdentity
	Collectors        []Collector
}

type PayloadSource

type PayloadSource interface {
	Payload(context.Context, SnapshotRequest) ([]byte, error)
}

type PersistentSnapshotStore

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

func NewPersistentSnapshotStore

func NewPersistentSnapshotStore(store pconfig.Verification) (*PersistentSnapshotStore, error)

func (*PersistentSnapshotStore) Get

func (s *PersistentSnapshotStore) Get(ctx context.Context, provider string, hash []byte) (SnapshotRecord, bool, error)

func (*PersistentSnapshotStore) Latest

func (s *PersistentSnapshotStore) Latest(ctx context.Context, provider string) (SnapshotRecord, bool, error)

func (*PersistentSnapshotStore) Put

type RecordingSnapshotter

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

func NewRecordingSnapshotter

func NewRecordingSnapshotter(next SnapshotBuilder, store SnapshotStore, now func() time.Time) (*RecordingSnapshotter, error)

func (*RecordingSnapshotter) Build

func (*RecordingSnapshotter) Committed

func (s *RecordingSnapshotter) Committed(ctx context.Context, hash []byte) (SnapshotRecord, bool, error)

func (*RecordingSnapshotter) LatestCommitted

func (s *RecordingSnapshotter) LatestCommitted(ctx context.Context) (SnapshotRecord, bool, error)

func (*RecordingSnapshotter) Provider

func (s *RecordingSnapshotter) Provider() string

type Snapshot

type Snapshot struct {
	Payload   []byte
	Hash      []byte
	Signature []byte
	Provider  string
}

type SnapshotBuilder

type SnapshotBuilder interface {
	Provider() string
	Build(context.Context, SnapshotRequest) (*Snapshot, error)
}

type SnapshotMaterial

type SnapshotMaterial struct {
	Cluster           inventoryv1.Cluster
	ActiveLeases      uint32
	EvidenceSections  []inventoryv1.SnapshotEvidenceSection
	SoftwareVersion   string
	SoftwareSignature []byte
	SoftwareIdentity  *inventoryv1.SoftwareIdentity
}

type SnapshotMaterialSource

type SnapshotMaterialSource interface {
	SnapshotMaterial(context.Context) (SnapshotMaterial, error)
}

type SnapshotRecord

type SnapshotRecord struct {
	Snapshot      Snapshot           `json:"snapshot"`
	SchemaVersion uint32             `json:"schema_version"`
	CreatedAt     time.Time          `json:"created_at"`
	Validation    SnapshotValidation `json:"validation"`
}

func NewSnapshotRecord

func NewSnapshotRecord(snapshot *Snapshot, schemaVersion uint32, createdAt time.Time) (SnapshotRecord, error)

type SnapshotRequest

type SnapshotRequest struct {
	Nonce []byte
}

type SnapshotValidation

type SnapshotValidation struct {
	Status      SnapshotValidationStatus `json:"status"`
	Error       string                   `json:"error,omitempty"`
	ValidatedAt time.Time                `json:"validated_at,omitempty"`
}

type SnapshotValidationStatus

type SnapshotValidationStatus string
const (
	SnapshotValidationStatusUnvalidated SnapshotValidationStatus = "unvalidated"
	SnapshotValidationStatusValid       SnapshotValidationStatus = "valid"
	SnapshotValidationStatusInvalid     SnapshotValidationStatus = "invalid"
)

type StatusClient

type StatusClient interface {
	StatusV1(context.Context) (*providerv1.Status, error)
}

type StatusPayloadSource

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

func (*StatusPayloadSource) Payload

func (s *StatusPayloadSource) Payload(ctx context.Context, req SnapshotRequest) ([]byte, error)

func (*StatusPayloadSource) SnapshotMaterial

func (s *StatusPayloadSource) SnapshotMaterial(ctx context.Context) (SnapshotMaterial, error)

type StatusPayloadSourceConfig

type StatusPayloadSourceConfig struct {
	Status            StatusClient
	Provider          string
	ChainID           string
	SoftwareVersion   string
	SoftwareSignature []byte
	SoftwareIdentity  *inventoryv1.SoftwareIdentity
	Now               func() time.Time
	Collectors        []Collector
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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