manifest

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrShutdownTimerExpired for a terminating deployment
	ErrShutdownTimerExpired = errors.New("shutdown timer expired")
	// ErrManifestVersion indicates that the given manifest's version does not
	// match the blockchain Version value.
	ErrManifestVersion         = errors.New("manifest version validation failed")
	ErrNoManifestForDeployment = errors.New("manifest not yet received for that deployment")
	ErrNoLeaseForDeployment    = errors.New("no lease for deployment")
)
View Source
var AutoFetchManifestEnabled = true

AutoFetchManifestEnabled checks if auto-fetch is enabled

View Source
var ContentStoreBasePath = "/root/.akash-providers/manifest-store"

ContentStoreBasePath is the path to the local content store Manifests are stored as files named by their SHA256 hash (hex-encoded)

View Source
var DefaultContractImage = "nginx:alpine"

DefaultContractImage is the image used for contract-owned deployments Can be overridden via environment variable AKASH_CONTRACT_DEFAULT_IMAGE

View Source
var ErrNotRunning = errors.New("not running")

ErrNotRunning is the error when service is not running

Functions

func AllHostnamesOfManifestGroup

func AllHostnamesOfManifestGroup(mgroup manitypes.Group) []string

func ComputeManifestHash

func ComputeManifestHash(manifestBytes []byte) []byte

ComputeManifestHash computes SHA256 hash of manifest bytes

func CreateDefaultManifest

func CreateDefaultManifest(owner string, dseq uint64) maniv2beta3.Manifest

CreateDefaultManifest creates a default manifest for a deployment This is used when no manifest is stored on-chain

func CreateDefaultManifestWithImage

func CreateDefaultManifestWithImage(owner string, dseq uint64, image string) maniv2beta3.Manifest

CreateDefaultManifestWithImage creates a manifest with a specific image

func EnsureContentStoreExists

func EnsureContentStoreExists() error

EnsureContentStoreExists creates the content store directory if it doesn't exist

func FetchManifestByHash

func FetchManifestByHash(hash string) (maniv2beta3.Manifest, error)

FetchManifestByHash fetches a manifest from the content store using its hash

func GenerateManifestFromSDL

func GenerateManifestFromSDL(sdl string) (maniv2beta3.Manifest, error)

GenerateManifestFromSDL generates a manifest from an SDL string This is a simplified version - the actual implementation would use the Akash SDL parser

func GetDefaultContractImage

func GetDefaultContractImage() string

GetDefaultContractImage returns the configured default image

func IngressHost

func IngressHost(lid mtypes.LeaseID, svcName string) string

func IsContractOwned

func IsContractOwned(owner string) bool

IsContractOwned checks if a deployment is owned by a contract Contract addresses in Cosmos are typically longer than regular accounts

func IsContractOwnedDeployment

func IsContractOwnedDeployment(did dtypes.DeploymentID) bool

IsContractOwnedDeployment checks if a deployment ID is owned by a contract

func ManifestKey

func ManifestKey(owner string, dseq uint64) string

ManifestKey formats the canonical cache key. Centralised so the filesystem backend, the S3 backend, and any future backends all agree on "how do I look up this deployment?".

func ParseManifestFromChain

func ParseManifestFromChain(manifestBytes []byte) (maniv2beta3.Manifest, error)

ParseManifestFromChain parses a manifest from chain storage format

func ParseManifestJSON

func ParseManifestJSON(manifestBytes []byte) (maniv2beta3.Manifest, error)

ParseManifestJSON parses SDK-compatible manifest JSON bytes into a Manifest Accepts the canonical JSON format matching maniv2beta3.Manifest protobuf schema

func SetAutoFetchManifest

func SetAutoFetchManifest(enabled bool)

SetAutoFetchManifest enables or disables auto-fetch of manifests from chain

func SetContentStorePath

func SetContentStorePath(path string)

SetContentStorePath sets the path to the local content store

func SetDefaultBackend

func SetDefaultBackend(b ManifestBackend)

SetDefaultBackend installs the process-wide manifest backend used by the manifest fetcher. Call at startup from the provider-services command wiring based on `--manifest-backend`.

func SetDefaultContractImage

func SetDefaultContractImage(image string)

SetDefaultContractImage sets the default image for contract deployments

func StoreManifest

func StoreManifest(manifestBytes []byte) (string, error)

StoreManifest stores a manifest in the content store Returns the hash (filename) of the stored manifest

func StoreManifestForDeployment

func StoreManifestForDeployment(owner string, dseq uint64, manifestBytes []byte) error

StoreManifestForDeployment stores a manifest indexed by owner/dseq for easy lookup

Types

type ChainManifestFetcher

type ChainManifestFetcher interface {
	// FetchManifest attempts to fetch a manifest from the chain
	// Returns nil if no manifest is stored on-chain for this deployment
	FetchManifest(ctx context.Context, owner string, dseq uint64) (maniv2beta3.Manifest, error)
}

ChainManifestFetcher fetches manifests from on-chain storage

func NewManifestAutoFetcher

func NewManifestAutoFetcher(queryClient interface{}) ChainManifestFetcher

NewManifestAutoFetcher creates a new manifest auto-fetcher

func NewManifestAutoFetcherWithStore

func NewManifestAutoFetcherWithStore(queryClient interface{}, contentStorePath string) ChainManifestFetcher

NewManifestAutoFetcherWithStore creates a fetcher with custom content store path

type ChainManifestResponse

type ChainManifestResponse struct {
	Owner     string `json:"owner"`
	DSeq      uint64 `json:"dseq"`
	Manifest  []byte `json:"manifest"`
	SDL       string `json:"sdl"`
	Hash      []byte `json:"hash"`
	Version   uint32 `json:"version"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
	Found     bool   `json:"found"`
}

ChainManifestResponse represents the response from chain manifest query

type Client

type Client interface {
	Submit(context.Context, dtypes.DeploymentID, manifest.Manifest) error
	IsActive(context.Context, dtypes.DeploymentID) (bool, error)
}

Client is the interface that wraps HandleManifest method

type FilesystemBackend

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

FilesystemBackend persists manifests to a directory on local disk.

func NewFilesystemBackend

func NewFilesystemBackend(base string) *FilesystemBackend

NewFilesystemBackend constructs a filesystem-backed ManifestBackend. Pass "" to fall back to the legacy ContentStoreBasePath constant.

func (*FilesystemBackend) Get

func (f *FilesystemBackend) Get(_ context.Context, key string) ([]byte, string, error)

Get reads the manifest bytes and their sha256 hex digest.

func (*FilesystemBackend) Name

func (f *FilesystemBackend) Name() string

Name identifies the backend in logs and health responses.

func (*FilesystemBackend) Ping

Ping round-trips a tiny sentinel file to prove the directory is writable. Errors surface as manifest_store_ok=false in /health.

func (*FilesystemBackend) Put

func (f *FilesystemBackend) Put(_ context.Context, key string, body []byte) (string, error)

Put writes the manifest bytes to <base>/<key>.json and also to the content-hash alias <base>/<sha>.json, matching pre-P0.4 semantics.

type ManifestBackend

type ManifestBackend interface {
	// Get returns the stored bytes and their sha256 hex digest. A
	// non-nil error signals "not found" or a transport-level problem;
	// callers should treat errors as cache misses and fall back to
	// authoritative sources (on-chain, default manifest, etc).
	Get(ctx context.Context, key string) ([]byte, string, error)

	// Put writes the given bytes to the backend and returns their
	// sha256 hex digest. Implementations must be safe under concurrent
	// writes with the same key (last-write-wins is acceptable).
	Put(ctx context.Context, key string, body []byte) (sha string, err error)

	// Name identifies the backend in logs / the /health response.
	Name() string

	// Ping round-trips a tiny key to prove the backend is reachable
	// and writeable. Used by the /health handler and the manifest
	// store watchdog. Implementations should keep the probe cheap.
	Ping(ctx context.Context) error
}

ManifestBackend is the pluggable manifest blob store.

func DefaultBackend

func DefaultBackend() ManifestBackend

DefaultBackend returns the currently-installed backend. Returns nil if no backend has been installed, signalling "fall back to legacy filesystem path at ContentStoreBasePath".

type S3Backend

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

S3Backend is a ManifestBackend backed by an S3-compatible object store.

func NewS3Backend

func NewS3Backend(ctx context.Context, cfg S3BackendConfig) (*S3Backend, error)

NewS3Backend wires up the AWS SDK v2 client with the operator's configuration.

func (*S3Backend) Get

func (s *S3Backend) Get(ctx context.Context, key string) ([]byte, string, error)

Get reads an object and returns its bytes + sha256 hex digest.

func (*S3Backend) Name

func (s *S3Backend) Name() string

Name identifies the backend in logs / health output.

func (*S3Backend) Ping

func (s *S3Backend) Ping(ctx context.Context) error

Ping is implemented as a bucket-head with a stat call on a sentinel key. The sentinel may legitimately not exist yet — we only treat transport-level errors as "unhealthy". We deliberately avoid HeadBucket because MinIO / R2 return 403 for unauthenticated head against a bucket even when the bucket is reachable.

func (*S3Backend) Put

func (s *S3Backend) Put(ctx context.Context, key string, body []byte) (string, error)

Put writes `body` to the configured bucket and returns its sha256.

type S3BackendConfig

type S3BackendConfig struct {
	Bucket          string
	Endpoint        string // empty means AWS default resolver
	Region          string // required; defaults to "us-east-1"
	AccessKeyID     string
	SecretAccessKey string
	// UsePathStyle flips virtual-host-style addressing off. MinIO and
	// many other self-hosted providers require path-style.
	UsePathStyle bool
	// KeyPrefix is prepended to every key (e.g. "manifests/"). Left
	// empty means keys land at the bucket root.
	KeyPrefix string
}

S3BackendConfig captures the operator-provided knobs needed to instantiate an S3-compatible backend.

type Service

type Service interface {
	StatusClient
	Client
	Done() <-chan struct{}
}

Service is the interface that includes StatusClient and Handler interfaces. It also wraps Done method

func NewService

func NewService(ctx context.Context, session session.Session, bus pubsub.Bus, hostnameService clustertypes.HostnameServiceClient, cfg ServiceConfig) (Service, error)

NewService creates and returns new Service instance Manage incoming leases and manifests and pair the two together to construct and emit a ManifestReceived event.

type ServiceConfig

type ServiceConfig struct {
	HTTPServicesRequireAtLeastOneHost bool
	ManifestTimeout                   time.Duration
	RPCQueryTimeout                   time.Duration
	CachedResultMaxAge                time.Duration
}

type StatusClient

type StatusClient interface {
	Status(context.Context) (*apclient.ManifestStatus, error)
	StatusV1(context.Context) (*provider.ManifestStatus, error)
}

StatusClient is the interface which includes status of service

Jump to

Keyboard shortcuts

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