Skip to main content
Glama
content_address.rs2.93 kB
use serde::{ Deserialize, Serialize, }; use si_events::ContentHash; use strum::EnumDiscriminants; #[derive( EnumDiscriminants, Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Hash, strum::Display, )] #[strum_discriminants(derive(strum::Display, Serialize, Deserialize))] /// The type of the object, and the content-addressable-storage address (content hash) /// of the object itself. /// NOTE: This type is postcard serialized, so cannot be /// #[remain::sorted]. New enum variants must come at the end of the enum! pub enum ContentAddress { ActionPrototype(ContentHash), AttributePrototype(ContentHash), Component(ContentHash), // TODO(fnichol): remove the `Deprecated*` variants DeprecatedAction(ContentHash), DeprecatedActionBatch(ContentHash), DeprecatedActionRunner(ContentHash), Func(ContentHash), FuncArg(ContentHash), InputSocket(ContentHash), JsonValue(ContentHash), Module(ContentHash), OutputSocket(ContentHash), Prop(ContentHash), Root, Schema(ContentHash), SchemaVariant(ContentHash), Secret(ContentHash), StaticArgumentValue(ContentHash), ValidationOutput(ContentHash), // With validations moving to the props and not having prototypes anymore, this is unused // TODO(victor): remove this when we migrate the graph next ValidationPrototype(ContentHash), ManagementPrototype(ContentHash), Geometry(ContentHash), View(ContentHash), ApprovalRequirementDefinition(ContentHash), AttributePaths(ContentHash), } impl ContentAddress { pub fn content_hash(&self) -> ContentHash { match self { ContentAddress::Root => None, ContentAddress::ActionPrototype(id) | ContentAddress::AttributePrototype(id) | ContentAddress::Component(id) | ContentAddress::DeprecatedAction(id) | ContentAddress::DeprecatedActionBatch(id) | ContentAddress::DeprecatedActionRunner(id) | ContentAddress::FuncArg(id) | ContentAddress::Func(id) | ContentAddress::Geometry(id) | ContentAddress::JsonValue(id) | ContentAddress::InputSocket(id) | ContentAddress::Module(id) | ContentAddress::OutputSocket(id) | ContentAddress::Prop(id) | ContentAddress::Schema(id) | ContentAddress::SchemaVariant(id) | ContentAddress::Secret(id) | ContentAddress::StaticArgumentValue(id) | ContentAddress::ValidationPrototype(id) | ContentAddress::ValidationOutput(id) | ContentAddress::View(id) | ContentAddress::ManagementPrototype(id) | ContentAddress::ApprovalRequirementDefinition(id) | ContentAddress::AttributePaths(id) => Some(*id), } .unwrap_or_default() } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server