Documentation
¶
Overview ¶
Package server gives applications authenticated HTTP, live-query, and RPC access to Meldbase.
Applications opt into this package separately from the storage engine.
Stability: Alpha. This Go API can change between alpha releases. The versioned HTTP and realtime wire contracts have their own compatibility policy; see https://meldbase.com/protocol-stability.
Index ¶
- Constants
- Variables
- type Actor
- type Authenticator
- type Authorizer
- type CollectionAccess
- type CollectionAccessFields
- type CollectionAccessManifest
- type CollectionAccessMode
- type Config
- type DeletePolicy
- type DurablePolicyGenerationStore
- type DurableRPCIdempotencyStore
- type HS256JWTAuthenticator
- type HS256JWTAuthenticatorConfig
- type Handler
- type InsertPolicy
- type MeldbaseError
- type MeldbaseInternalError
- type PolicyGenerationStore
- type QueryPolicy
- type QueryPolicyLease
- type QueryPolicyResolver
- type RPCAuthorizer
- type RPCIdempotencyClaim
- type RPCIdempotencyCompletion
- type RPCIdempotencyDecision
- type RPCIdempotencyDecisionKind
- type RPCIdempotencyMaintenance
- type RPCIdempotencyStore
- type RPCMethod
- type RPCMethodResolver
- type RPCTransactionalMethod
- type RPCTransactionalMethodResolver
- type RS256JWKSAuthenticator
- type RS256JWKSAuthenticatorConfig
- type ServerStats
- type UpdatePolicy
- type WorkerAuthenticator
- type WorkerHub
- type WorkerHubConfig
- type WorkerHubStats
- type WorkerIdentity
- type WorkspaceAuthorizer
- type WorkspaceAuthorizerConfig
Constants ¶
const ( // ProtocolVersion identifies the current realtime and RPC envelope version. ProtocolVersion = internal.ProtocolVersion // RPCIdempotencyExecute grants ownership of a new pending request. RPCIdempotencyExecute = internal.RPCIdempotencyExecute // RPCIdempotencyReplayResult returns a previously recorded successful result. RPCIdempotencyReplayResult = internal.RPCIdempotencyReplayResult // RPCIdempotencyReplayError returns a previously recorded error. RPCIdempotencyReplayError = internal.RPCIdempotencyReplayError // RPCIdempotencyInProgress reports that the same request is pending in the current session. RPCIdempotencyInProgress = internal.RPCIdempotencyInProgress // RPCIdempotencyOutcomeUnknown reports an uncertain outcome that prevents safe re-execution. RPCIdempotencyOutcomeUnknown = internal.RPCIdempotencyOutcomeUnknown // RPCIdempotencyConflict reports that the key was used for a different request. RPCIdempotencyConflict = internal.RPCIdempotencyConflict // CollectionAccessCollaborative allows verified workspace members to read and mutate the collection. CollectionAccessCollaborative = internal.CollectionAccessCollaborative // CollectionAccessOwner limits access to documents the actor owns within its workspace. CollectionAccessOwner = internal.CollectionAccessOwner // CollectionAccessRPCOnly rejects generic data operations while allowing separately authorized RPC methods. CollectionAccessRPCOnly = internal.CollectionAccessRPCOnly // CollectionAccessManifestVersion identifies the supported collection access manifest format. CollectionAccessManifestVersion = internal.CollectionAccessManifestVersion // CollectionAccessManifestSchemaURL identifies the published collection access manifest schema. CollectionAccessManifestSchemaURL = internal.CollectionAccessManifestSchemaURL )
Variables ¶
var ( // ErrUnauthenticated reports missing or invalid authentication. ErrUnauthenticated = internal.ErrUnauthenticated // ErrForbidden reports an operation rejected by access policy. ErrForbidden = internal.ErrForbidden )
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator = internal.Authenticator
Authenticator verifies HTTP credentials and returns an application identity.
type Authorizer ¶
type Authorizer = internal.Authorizer
Authorizer supplies server-enforced document read and mutation policies.
type CollectionAccess ¶
type CollectionAccess = internal.CollectionAccess
CollectionAccess declares a collection's generic data access rules.
type CollectionAccessFields ¶
type CollectionAccessFields = internal.CollectionAccessFields
CollectionAccessFields defines optional field permissions for generic client operations.
type CollectionAccessManifest ¶
type CollectionAccessManifest = internal.CollectionAccessManifest
CollectionAccessManifest declares generic client data access rules without executable policy callbacks.
func ParseCollectionAccessManifestJSON ¶
func ParseCollectionAccessManifestJSON(data []byte) (CollectionAccessManifest, error)
ParseCollectionAccessManifestJSON validates and decodes a collection access manifest.
type CollectionAccessMode ¶
type CollectionAccessMode = internal.CollectionAccessMode
CollectionAccessMode identifies the generic data access mode for a collection.
type Config ¶
Config sets the database, security policies, transport limits, and optional RPC services.
type DeletePolicy ¶
type DeletePolicy = internal.DeletePolicy
DeletePolicy combines row-selection permissions with an affected-document limit.
type DurablePolicyGenerationStore ¶
type DurablePolicyGenerationStore = internal.DurablePolicyGenerationStore
DurablePolicyGenerationStore reads policy generations from database system records.
func NewDurablePolicyGenerationStore ¶
func NewDurablePolicyGenerationStore(db *meldbase.DB) (*DurablePolicyGenerationStore, error)
NewDurablePolicyGenerationStore creates a policy generation reader backed by an open database.
type DurableRPCIdempotencyStore ¶
type DurableRPCIdempotencyStore = internal.DurableRPCIdempotencyStore
DurableRPCIdempotencyStore combines durable request ownership with expired-record maintenance.
func NewDurableRPCIdempotencyStore ¶
func NewDurableRPCIdempotencyStore(db *meldbase.DB) (DurableRPCIdempotencyStore, error)
NewDurableRPCIdempotencyStore creates an RPC idempotency store backed by database system records.
type HS256JWTAuthenticator ¶
type HS256JWTAuthenticator = internal.HS256JWTAuthenticator
HS256JWTAuthenticator verifies bearer JWTs and maps their identity and workspace claims to an actor.
func NewHS256JWTAuthenticator ¶
func NewHS256JWTAuthenticator(config HS256JWTAuthenticatorConfig) (*HS256JWTAuthenticator, error)
NewHS256JWTAuthenticator creates a JWT authenticator from the configured signing secrets.
type HS256JWTAuthenticatorConfig ¶
type HS256JWTAuthenticatorConfig = internal.HS256JWTAuthenticatorConfig
HS256JWTAuthenticatorConfig sets signing secrets and claim rules for HS256 token verification.
type InsertPolicy ¶
type InsertPolicy = internal.InsertPolicy
InsertPolicy defines accepted input fields, server-owned values, and permitted result fields.
type MeldbaseError ¶
type MeldbaseError = internal.MeldbaseError
MeldbaseError carries an expected business error code and optional safe data for the caller.
type MeldbaseInternalError ¶
type MeldbaseInternalError = internal.MeldbaseInternalError
MeldbaseInternalError carries a server-owned RPC error code and HTTP status.
type PolicyGenerationStore ¶
type PolicyGenerationStore = internal.PolicyGenerationStore
PolicyGenerationStore reads a collection's persisted policy generation.
type QueryPolicy ¶
type QueryPolicy = internal.QueryPolicy
QueryPolicy defines query constraints, field permissions, limits, and revocation leases.
type QueryPolicyLease ¶
type QueryPolicyLease = internal.QueryPolicyLease
QueryPolicyLease coordinates policy revocation with authorized response delivery.
func NewQueryPolicyLease ¶
func NewQueryPolicyLease(version string) (*QueryPolicyLease, error)
NewQueryPolicyLease creates an active lease for a nonempty policy version.
type QueryPolicyResolver ¶
type QueryPolicyResolver = internal.QueryPolicyResolver
QueryPolicyResolver optionally supplies an additional policy that narrows an authorized query.
type RPCAuthorizer ¶
type RPCAuthorizer = internal.RPCAuthorizer
RPCAuthorizer checks call permission before input decoding or application execution.
type RPCIdempotencyClaim ¶
type RPCIdempotencyClaim = internal.RPCIdempotencyClaim
RPCIdempotencyClaim identifies a pending request and its ownership using hashes and tokens.
type RPCIdempotencyCompletion ¶
type RPCIdempotencyCompletion = internal.RPCIdempotencyCompletion
RPCIdempotencyCompletion pairs a request claim with the result or error to persist.
type RPCIdempotencyDecision ¶
type RPCIdempotencyDecision = internal.RPCIdempotencyDecision
RPCIdempotencyDecision carries an execution decision or a recorded result or error.
type RPCIdempotencyDecisionKind ¶
type RPCIdempotencyDecisionKind = internal.RPCIdempotencyDecisionKind
RPCIdempotencyDecisionKind identifies whether an RPC may execute or must use a recorded outcome.
type RPCIdempotencyMaintenance ¶
type RPCIdempotencyMaintenance = internal.RPCIdempotencyMaintenance
RPCIdempotencyMaintenance removes expired terminal records while preserving pending requests.
type RPCIdempotencyStore ¶
type RPCIdempotencyStore = internal.RPCIdempotencyStore
RPCIdempotencyStore durably claims requests and records their outcomes through conditional transitions.
type RPCMethod ¶
RPCMethod handles an authenticated application call whose effects are not atomic with its result.
type RPCMethodResolver ¶
type RPCMethodResolver = internal.RPCMethodResolver
RPCMethodResolver looks up dynamic methods when the local method registry has no match.
type RPCTransactionalMethod ¶
type RPCTransactionalMethod = internal.RPCTransactionalMethod
RPCTransactionalMethod stages database writes that commit together with a successful RPC result.
type RPCTransactionalMethodResolver ¶
type RPCTransactionalMethodResolver = internal.RPCTransactionalMethodResolver
RPCTransactionalMethodResolver looks up dynamic transaction-aware methods.
type RS256JWKSAuthenticator ¶
type RS256JWKSAuthenticator = internal.RS256JWKSAuthenticator
RS256JWKSAuthenticator verifies bearer JWTs using cached RSA keys from a public key endpoint.
func NewRS256JWKSAuthenticator ¶
func NewRS256JWKSAuthenticator(config RS256JWKSAuthenticatorConfig) (*RS256JWKSAuthenticator, error)
NewRS256JWKSAuthenticator creates a JWT authenticator that retrieves and caches public signing keys.
type RS256JWKSAuthenticatorConfig ¶
type RS256JWKSAuthenticatorConfig = internal.RS256JWKSAuthenticatorConfig
RS256JWKSAuthenticatorConfig sets the public key endpoint and claim rules for RS256 token verification.
type ServerStats ¶
type ServerStats = internal.ServerStats
ServerStats reports aggregate server activity without application identities or payloads.
type UpdatePolicy ¶
type UpdatePolicy = internal.UpdatePolicy
UpdatePolicy combines row-selection permissions with writable paths and an affected-document limit.
type WorkerAuthenticator ¶
type WorkerAuthenticator = internal.WorkerAuthenticator
WorkerAuthenticator verifies worker credentials separately from application credentials.
func NewWorkerTokenAuthenticator ¶
func NewWorkerTokenAuthenticator(token string) (WorkerAuthenticator, error)
NewWorkerTokenAuthenticator creates a constant-time bearer token authenticator for workers.
type WorkerHub ¶
WorkerHub routes dynamically registered methods from separately authenticated workers.
func NewWorkerHub ¶
func NewWorkerHub(config WorkerHubConfig) (*WorkerHub, error)
NewWorkerHub validates worker settings and creates an empty worker registration hub.
type WorkerHubConfig ¶
type WorkerHubConfig = internal.WorkerHubConfig
WorkerHubConfig sets worker authentication, registration limits, and dynamic policy controls.
type WorkerHubStats ¶
type WorkerHubStats = internal.WorkerHubStats
WorkerHubStats reports worker connections, execution, protocol failures, and policy activity.
type WorkerIdentity ¶
type WorkerIdentity = internal.WorkerIdentity
WorkerIdentity identifies an authenticated control-plane worker.
type WorkspaceAuthorizer ¶
type WorkspaceAuthorizer = internal.WorkspaceAuthorizer
WorkspaceAuthorizer enforces collection and RPC permissions within the actor's active workspace.
func NewWorkspaceAuthorizer ¶
func NewWorkspaceAuthorizer(config WorkspaceAuthorizerConfig) (*WorkspaceAuthorizer, error)
NewWorkspaceAuthorizer creates workspace-scoped access policies from validated collection rules.
type WorkspaceAuthorizerConfig ¶
type WorkspaceAuthorizerConfig = internal.WorkspaceAuthorizerConfig
WorkspaceAuthorizerConfig configures collection and RPC access within an authenticated workspace.