diff --git a/hyperactor_mesh/src/resource.rs b/hyperactor_mesh/src/resource.rs index 9cc23e2c6..d4edb73b3 100644 --- a/hyperactor_mesh/src/resource.rs +++ b/hyperactor_mesh/src/resource.rs @@ -9,6 +9,8 @@ //! This modules defines a set of common message types used for managing resources //! in hyperactor meshes. +pub mod mesh; + use core::slice::GetDisjointMutIndex as _; use std::collections::HashMap; use std::fmt; diff --git a/hyperactor_mesh/src/resource/mesh.rs b/hyperactor_mesh/src/resource/mesh.rs new file mode 100644 index 000000000..bcc4ce5bd --- /dev/null +++ b/hyperactor_mesh/src/resource/mesh.rs @@ -0,0 +1,53 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +#![allow(dead_code)] + +use hyperactor::Named; +/// This module defines common types for mesh resources. Meshes are managed as +/// resources, usually by a controller actor implementing the [`crate::resource`] +/// behavior. +/// +/// The mesh controller manages all aspects of the mesh lifecycle, and the owning +/// actor uses the resource behavior directly to query the state of the mesh. +use ndslice::Extent; +use serde::Deserialize; +use serde::Serialize; + +use crate::resource::CreateOrUpdate; +use crate::resource::GetState; +use crate::resource::Status; +use crate::resource::Stop; +use crate::v1::ValueMesh; + +/// Mesh specs +#[derive(Debug, Named, Serialize, Deserialize)] +pub struct Spec { + /// All meshes have an extent + extent: Extent, + // supervisor: PortHandle + /// The mesh-specific spec. + spec: S, +} + +/// Mesh states +#[derive(Debug, Named, Serialize, Deserialize)] +pub struct State { + /// The current status for each rank in the mesh. + statuses: ValueMesh, + /// Mesh-specific state. + state: S, +} + +// The behavior of a mesh controllšr. +// hyperactor::behavior!( +// Controller, +// CreateOrUpdate>, +// GetState>, +// Stop, +// );