Skip to main content

Crate haystack_server

Crate haystack_server 

Source
Expand description

Haystack HTTP API server with SCRAM auth, WebSocket watches, and federation.

Provides HaystackServer — an Actix Web-based HTTP server implementing the full Project Haystack REST API with 30+ standard operations.

§Features

  • 30+ Haystack ops — about, read, nav, hisRead, hisWrite, pointWrite, watchSub, watchPoll, watchUnsub, invokeAction, defs, libs, formats, and more
  • SCRAM SHA-256 auth — Token-based authentication with configurable TTL
  • WebSocket watches — Real-time entity change subscriptions with compression
  • Federation — Hub-and-spoke topology with automatic entity routing, delta sync, and adaptive intervals
  • History store — In-memory time-series storage for his-tagged points
  • Content negotiation — Zinc, JSON, JSON v3, CSV via Accept header

§Quick Start

use haystack_core::graph::{EntityGraph, SharedGraph};
use haystack_server::HaystackServer;

let graph = SharedGraph::new(EntityGraph::new());
HaystackServer::new(graph)
    .port(8080)
    .host("0.0.0.0")
    .run()
    .await

Re-exports§

pub use app::HaystackServer;
pub use federation::Federation;

Modules§

actions
Action registry for the invokeAction op.
app
Server builder and startup.
auth
Server-side authentication manager using SCRAM SHA-256.
connector
Connector for fetching entities from a remote Haystack server.
content
Content negotiation — parse Accept header to pick codec, decode request body.
demo
error
Haystack error grids and Actix Web error integration.
federation
Federation manager — coordinates multiple remote connectors for federated queries.
his_store
In-memory time-series store for historical data (hisRead / hisWrite).
ops
Haystack HTTP API op handlers and route registration.
state
Application state shared across all request handlers.
ws
WebSocket handler and watch subscription manager.