pub struct ApiaryNode {
pub config: NodeConfig,
pub storage: Arc<dyn StorageBackend>,
pub registry: Arc<RegistryManager>,
pub query_ctx: Arc<Mutex<ApiaryQueryContext>>,
pub bee_pool: Arc<BeePool>,
pub cell_cache: Arc<CellCache>,
pub thermometer: ColonyThermometer,
pub abandonment_tracker: Arc<AbandonmentTracker>,
/* private fields */
}Expand description
An Apiary compute node — the runtime for one machine in the swarm.
The node holds a reference to the storage backend and its configuration.
In solo mode it uses LocalBackend; in multi-node mode it uses
S3Backend. The node is otherwise stateless — all committed state
lives in object storage.
Fields§
§config: NodeConfigNode configuration including auto-detected capacity.
storage: Arc<dyn StorageBackend>The shared storage backend (object storage or local filesystem).
registry: Arc<RegistryManager>Registry manager for DDL operations.
query_ctx: Arc<Mutex<ApiaryQueryContext>>DataFusion-based SQL query context.
bee_pool: Arc<BeePool>Pool of bees for isolated task execution.
cell_cache: Arc<CellCache>Local cell cache with LRU eviction.
thermometer: ColonyThermometerColony thermometer for measuring system health.
abandonment_tracker: Arc<AbandonmentTracker>Abandonment tracker for task failure handling.
Implementations§
Source§impl ApiaryNode
impl ApiaryNode
Sourcepub async fn start(config: NodeConfig) -> Result<Self>
pub async fn start(config: NodeConfig) -> Result<Self>
Start a new Apiary node with the given configuration.
Initialises the appropriate storage backend based on config.storage_uri
and logs the node’s capacity.
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Gracefully shut down the node.
Stops background tasks (heartbeat writer, world view builder), deletes the heartbeat file, and cleans up resources.
Sourcepub async fn write_to_frame(
&self,
hive: &str,
box_name: &str,
frame_name: &str,
batch: &RecordBatch,
) -> Result<WriteResult>
pub async fn write_to_frame( &self, hive: &str, box_name: &str, frame_name: &str, batch: &RecordBatch, ) -> Result<WriteResult>
Write data to a frame. This is the end-to-end write path:
- Resolve frame from registry
- Open/create ledger
- Validate schema
- Partition data
- Write cells to storage
- Commit ledger entry
Sourcepub async fn read_from_frame(
&self,
hive: &str,
box_name: &str,
frame_name: &str,
partition_filter: Option<&HashMap<String, String>>,
) -> Result<Option<RecordBatch>>
pub async fn read_from_frame( &self, hive: &str, box_name: &str, frame_name: &str, partition_filter: Option<&HashMap<String, String>>, ) -> Result<Option<RecordBatch>>
Read data from a frame, optionally filtering by partition values. Returns all matching data as a merged RecordBatch.
Sourcepub async fn overwrite_frame(
&self,
hive: &str,
box_name: &str,
frame_name: &str,
batch: &RecordBatch,
) -> Result<WriteResult>
pub async fn overwrite_frame( &self, hive: &str, box_name: &str, frame_name: &str, batch: &RecordBatch, ) -> Result<WriteResult>
Overwrite all data in a frame with new data. Commits a RewriteCells entry removing all existing cells and adding new ones.
Sourcepub async fn init_frame_ledger(
&self,
hive: &str,
box_name: &str,
frame_name: &str,
) -> Result<()>
pub async fn init_frame_ledger( &self, hive: &str, box_name: &str, frame_name: &str, ) -> Result<()>
Initialize the ledger for a frame (called after create_frame in registry).
Sourcepub async fn sql(&self, query: &str) -> Result<Vec<RecordBatch>>
pub async fn sql(&self, query: &str) -> Result<Vec<RecordBatch>>
Execute a SQL query and return results as RecordBatches.
The query is executed through the BeePool — assigned to an idle bee or queued if all bees are busy. Each bee runs in its own sealed chamber with memory budget and timeout enforcement.
Supports:
- Standard SQL (SELECT, GROUP BY, ORDER BY, etc.) over frames
- Custom commands: USE HIVE, USE BOX, SHOW HIVES, SHOW BOXES, SHOW FRAMES, DESCRIBE
- 3-part table names: hive.box.frame
- 1-part names after USE HIVE / USE BOX
Sourcepub async fn bee_status(&self) -> Vec<BeeStatus>
pub async fn bee_status(&self) -> Vec<BeeStatus>
Return the status of each bee in the pool.
Sourcepub async fn world_view(&self) -> WorldView
pub async fn world_view(&self) -> WorldView
Return the current world view snapshot.
Sourcepub async fn swarm_status(&self) -> SwarmStatus
pub async fn swarm_status(&self) -> SwarmStatus
Return swarm status: a summary of all nodes visible to this node.
Sourcepub async fn colony_status(&self) -> ColonyStatus
pub async fn colony_status(&self) -> ColonyStatus
Return the current colony status: temperature and regulation state.
Sourcepub async fn sql_distributed(&self, query: &str) -> Result<Vec<RecordBatch>>
pub async fn sql_distributed(&self, query: &str) -> Result<Vec<RecordBatch>>
Execute a distributed query (v2 feature - explicit control).
This method is reserved for v2 when users want explicit control over distributed execution strategy. In v1, distributed execution happens transparently within the query context based on query planning.
Auto Trait Implementations§
impl Freeze for ApiaryNode
impl !RefUnwindSafe for ApiaryNode
impl Send for ApiaryNode
impl Sync for ApiaryNode
impl Unpin for ApiaryNode
impl UnsafeUnpin for ApiaryNode
impl !UnwindSafe for ApiaryNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more