Documentation
¶
Index ¶
- Variables
- func AllHostnamesOfManifestGroup(mgroup manitypes.Group) []string
- func ComputeManifestHash(manifestBytes []byte) []byte
- func CreateDefaultManifest(owner string, dseq uint64) maniv2beta3.Manifest
- func CreateDefaultManifestWithImage(owner string, dseq uint64, image string) maniv2beta3.Manifest
- func EnsureContentStoreExists() error
- func FetchManifestByHash(hash string) (maniv2beta3.Manifest, error)
- func GenerateManifestFromSDL(sdl string) (maniv2beta3.Manifest, error)
- func GetDefaultContractImage() string
- func IngressHost(lid mtypes.LeaseID, svcName string) string
- func IsContractOwned(owner string) bool
- func IsContractOwnedDeployment(did dtypes.DeploymentID) bool
- func ManifestKey(owner string, dseq uint64) string
- func ParseManifestFromChain(manifestBytes []byte) (maniv2beta3.Manifest, error)
- func ParseManifestJSON(manifestBytes []byte) (maniv2beta3.Manifest, error)
- func SetAutoFetchManifest(enabled bool)
- func SetContentStorePath(path string)
- func SetDefaultBackend(b ManifestBackend)
- func SetDefaultContractImage(image string)
- func StoreManifest(manifestBytes []byte) (string, error)
- func StoreManifestForDeployment(owner string, dseq uint64, manifestBytes []byte) error
- type ChainManifestFetcher
- type ChainManifestResponse
- type Client
- type FilesystemBackend
- type ManifestBackend
- type S3Backend
- type S3BackendConfig
- type Service
- type ServiceConfig
- type StatusClient
Constants ¶
This section is empty.
Variables ¶
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") )
var AutoFetchManifestEnabled = true
AutoFetchManifestEnabled checks if auto-fetch is enabled
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)
var DefaultContractImage = "nginx:alpine"
DefaultContractImage is the image used for contract-owned deployments Can be overridden via environment variable AKASH_CONTRACT_DEFAULT_IMAGE
var ErrNotRunning = errors.New("not running")
ErrNotRunning is the error when service is not running
Functions ¶
func ComputeManifestHash ¶
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 IsContractOwned ¶
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 ¶
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 ¶
StoreManifest stores a manifest in the content store Returns the hash (filename) of the stored manifest
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) Name ¶
func (f *FilesystemBackend) Name() string
Name identifies the backend in logs and health responses.
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) Ping ¶
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.
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 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