Skip to main content

akash_deploy_rs/
lib.rs

1//! Akash Deploy Library
2//!
3//! Standalone, trait-based deployment workflow engine for Akash Network.
4//!
5//! # Design
6//!
7//! This library provides the deployment workflow logic without coupling to
8//! any specific storage, signing, or transport implementation. You implement
9//! the [`AkashBackend`] trait with your infrastructure, and the workflow
10//! engine handles the state machine.
11//!
12//! # Usage
13//!
14//! ```ignore
15//! use akash_deploy_rs::{
16//!     AkashBackend, DeploymentState, DeploymentWorkflow, WorkflowConfig, StepResult,
17//! };
18//!
19//! // Implement AkashBackend for your infrastructure
20//! struct MyBackend { /* ... */ }
21//! impl AkashBackend for MyBackend { /* ... */ }
22//!
23//! // Create workflow
24//! let backend = MyBackend::new();
25//! let signer = MySigner::new();
26//! let config = WorkflowConfig::default();
27//! let workflow = DeploymentWorkflow::new(&backend, &signer, config);
28//!
29//! // Create state
30//! let mut state = DeploymentState::new("session-1", "akash1...")
31//!     .with_sdl(sdl_content)
32//!     .with_label("my-deploy");
33//!
34//! // Run to completion
35//! match workflow.run_to_completion(&mut state).await? {
36//!     StepResult::Complete => println!("Deployed!"),
37//!     StepResult::NeedsInput(input) => { /* handle user input */ },
38//!     StepResult::Failed(reason) => println!("Failed: {}", reason),
39//!     _ => {}
40//! }
41//! ```
42
43pub mod auth;
44pub mod error;
45pub mod gen;
46pub mod manifest;
47pub mod sdl;
48pub mod state;
49pub mod store;
50pub mod traits;
51pub mod types;
52pub mod workflow;
53
54#[cfg(feature = "default-client")]
55pub mod client;
56
57// Re-export the main types at crate root for convenience
58pub use auth::certificate::{decrypt_key, encrypt_key, generate_certificate, GeneratedCertificate};
59pub use auth::jwt::{CachedJwt, JwtBuilder, JwtClaims, JwtLeases};
60pub use error::DeployError;
61pub use manifest::canonical::to_canonical_json;
62pub use manifest::manifest::{
63    ManifestBuilder, ManifestCpu, ManifestCredentials, ManifestGpu, ManifestGroup,
64    ManifestHttpOptions, ManifestMemory, ManifestResourceValue, ManifestResources, ManifestService,
65    ManifestServiceExpose, ManifestServiceParams, ManifestStorage, ManifestStorageParams,
66};
67#[cfg(feature = "sdl-templates")]
68pub use sdl::template::{
69    apply_template, extract_variables, validate_template, SdlTemplate, TemplateDefaults,
70    TemplateVariables,
71};
72pub use state::{DeploymentState, Step};
73#[cfg(feature = "file-storage")]
74pub use store::FileBackedStorage;
75#[cfg(feature = "file-storage")]
76pub use store::FileDeploymentStore;
77pub use store::SessionStorage;
78pub use store::{DeploymentRecord, DeploymentStore};
79pub use traits::AkashBackend;
80pub use types::*;
81pub use workflow::{DeploymentWorkflow, InputRequired, StepResult, WorkflowConfig};
82
83#[cfg(feature = "default-client")]
84pub use client::{export_sessions, import_sessions, AkashClient, KeySigner};