Aster TypeScript 0.3.893
    Preparing search index...

    Class Node

    A running Aster node. Start one with Node.start; close it with close() or await using.

    Implements

    • AsyncDisposable

    Indexable

    • [key: number]: () => Promise<void>
        • (): Promise<void>
        • await using support.

          Returns Promise<void>

    Index

    Accessors

    • get addr(): NodeAddr

      This node's dialable address (id + current direct addresses).

      Returns NodeAddr

    • get hasHooks(): boolean

      Whether the node was started with admission hooks (or a gate).

      Returns boolean

    • get closed(): boolean

      Whether close() has been called.

      Returns boolean

    Methods

    • Start a node. In-memory unless config.storagePath is set. Only the given config is used — merge AsterConfig.fromEnv in yourself to honour ASTER_* variables.

      Parameters

      • Optionalconfig: AsterConfig
      • Optionaloptions: NodeStartOptions

      Returns Promise<Node>

    • Direct socket addresses ("ip:port") currently advertised. Empty until the endpoint has bound and discovered its local addresses.

      Returns string[]

    • The node's 32-byte secret key. Persist it (or set secretKeyFile) for a restart-stable identity — the store does not keep it.

      Returns Uint8Array

    • Attach a Gate-0 policy (null detaches it). Applies from the next admission decision. Needs a node started with hooks or a gate.

      Parameters

      • gate: GatePolicy | null

      Returns void

    • Admission requests raised while no gate is attached — iterate with for await and accept() / reject(code, reason) each. Outbound dials by this node appear as direction === 'outbound'. One iterator per node; needs a node started with enableHooks: true.

      Returns AsyncIterable<AdmissionRequest, any, any> & AdmissionRequests

    • Answer this node's admission requests with hooks over upcalls (kinds admission_handshake / admission_connect) — the alternative to admission; one or the other per node. An attached gate still decides first. Without an answer (error, timeout) the upcall policy's failure mode decides (fail-closed by default: a handshake is rejected with 403 "hook unavailable"); keep its timeout below the node's hookTimeoutMs. Outbound dials are allowed unless hooks.connect says otherwise. close() on the result removes the hooks (later requests then get the failure mode).

      Parameters

      • hooks: AdmissionHooks
      • Optionaloptions: { upcalls?: Upcalls }

      Returns { upcalls: Upcalls; close(): void }

    • Blob store client.

      Returns BlobsClient

    • Document sync client.

      Returns DocsClient

    • Gossip pub-sub client.

      Returns GossipClient

    • Open a connection to peer on alpn. With direct addresses / a relay URL the peer is dialed directly; a bare id relies on discovery.

      Parameters

      • peer: string | NodeId | NodeAddr
      • alpn: string | Uint8Array<ArrayBufferLike>

      Returns Promise<IrohConnection>

    • Serve /healthz, /readyz and /metrics (OTel Prometheus text, including the transport counters) on host:port from Rust. Port 0 binds an ephemeral port. Starts the observability pipeline from the environment when nothing has. Replaces the former metricsPrometheus().

      Parameters

      • Optionaloptions: { host?: string; port?: number }

      Returns Promise<HealthServer>

    • This node's topology view (v1 per-peer proximity; v2 shared swarm). Populates only when the node runs with enableMonitoring: true.

      Returns Topology

    • A lease backend on the designated grantor grantor (an aster.lease.Grantor service reached over RPC). The grantor must be dialable by id (discovery, or its address added beforehand).

      Parameters

      Returns Promise<GrantorSerializer>

    • Serve aster.lease.Grantor over serializer, making this node a designated grantor. Start the node with alpns: ['aster/1']. This owns the node's RPC accept loop — don't also run an RPC server on it. Returns a handle whose close() stops serving.

      Parameters

      • serializer: MemorySerializer | ForeignLeaseSerializer
      • Optionaloptions: LeaseGrantorOptions

      Returns { close(): void }

    • A fresh exposure registry (see Expose); its authorizers, HTTP handlers and route policies answer on options.upcalls or a private table.

      Parameters

      • Optionaloptions: { upcalls?: Upcalls }

      Returns Expose

    • Own this node's accept loop for expose: inbound connections on one of alpns (start the node with them in alpns) are fed to expose. Don't also run an RPC server on the node. close() stops accepting. Consumers open a stream with connection.openExposeStream(serviceId).

      Parameters

      Returns { close(): void }

    • Shut down cleanly (flushes persistent state first). Idempotent.

      Returns Promise<void>