Documentation
¶
Overview ¶
Package graphmutation owns the in-repository graph mutation protocol identity. Application callers use narrow typed clients rather than subjects directly. ClassifyPort decides whether a component port is a graph-mutation port and whether it has the valid shape; flowgraph and graph-ingest both call it.
Index ¶
- Constants
- func ClassifyPort(facts component.PortFacts, required bool) (member, valid bool)
- func IsDefinitelyNotCommitted(err error) bool
- func Subject(operation Operation) (string, error)
- type Client
- func (c *Client) Append(ctx context.Context, request graph.AppendTriplesRequest) (*graph.AppendTriplesResponse, error)
- func (c *Client) Create(ctx context.Context, request graph.CreateEntityRequest) (*graph.EntityMutationResponse, error)
- func (c *Client) Delete(ctx context.Context, request graph.DeleteEntityRequest) (*graph.DeleteEntityResponse, error)
- func (c *Client) Reconcile(ctx context.Context, request graph.ReconcilePredicatesRequest) (*graph.EntityMutationResponse, error)
- type Operation
- type TransportError
- type TransportOutcome
Constants ¶
const ( // InterfaceType is the canonical component-port interface identity. InterfaceType = "semengine.graph.mutation" // InterfaceVersion is the canonical component-port interface version. InterfaceVersion = "v1" // SubjectFamily is the only admitted NATS request/reply subject family. SubjectFamily = "graph.mutation.>" )
Variables ¶
This section is empty.
Functions ¶
func ClassifyPort ¶
ClassifyPort decides, for one component port, whether it is a graph-mutation port (member) and whether it has the one valid shape (valid). required is the port's Required flag, which PortFacts does not carry.
A port is a member when its interface type is InterfaceType, or when any one of its NATS subjects starts with the family's prefix, graph.mutation., whatever the port's kind. A member is valid when it is a required nats-request port whose subjects are exactly SubjectFamily and whose interface is InterfaceType at InterfaceVersion. valid implies member.
Flowgraph and graph-ingest both call it; each keeps its own direction rule, provider count and refusal text.
func IsDefinitelyNotCommitted ¶
IsDefinitelyNotCommitted reports transport outcomes that prove no request was delivered: no request was sent, or no responder took it, or the context was already done before the call.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the single in-repository adapter for the canonical mutation port. Each method makes exactly one request. It never retries an ambiguous delivery.
func (*Client) Append ¶
func (c *Client) Append(ctx context.Context, request graph.AppendTriplesRequest) (*graph.AppendTriplesResponse, error)
Append appends triples independently per distinct subject.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, request graph.CreateEntityRequest) (*graph.EntityMutationResponse, error)
Create performs one atomic entity birth request. A request without an entity is refused before sending.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, request graph.DeleteEntityRequest) (*graph.DeleteEntityResponse, error)
Delete conditionally deletes one entity at the supplied authority revision.
func (*Client) Reconcile ¶
func (c *Client) Reconcile( ctx context.Context, request graph.ReconcilePredicatesRequest, ) (*graph.EntityMutationResponse, error)
Reconcile makes one predicate set equal the supplied desired set.
type Operation ¶
type Operation string
Operation identifies one admitted graph mutation command.
const ( // CreateEntity strictly creates one entity and rejects an existing ID. CreateEntity Operation = "entity.create" // ReconcilePredicates replaces a declared predicate set under a revision fence. ReconcilePredicates Operation = "entity.reconcile" // AppendTriples adds set-valued triples to existing subjects. AppendTriples Operation = "triple.append" // DeleteEntity removes one entity under a revision fence. DeleteEntity Operation = "entity.delete" )
type TransportError ¶
type TransportError struct {
Operation Operation
Outcome TransportOutcome
Err error
}
TransportError is returned only for transport or invalid-reply failures. Classified handler failures remain their original typed error.
func (*TransportError) Error ¶
func (e *TransportError) Error() string
func (*TransportError) Unwrap ¶
func (e *TransportError) Unwrap() error
type TransportOutcome ¶
type TransportOutcome string
TransportOutcome describes what the requester can prove when no valid mutation reply exists. Only CommitUnknown permits that the command may have reached graph-ingest.
const ( // natsclient refused it before sending (ErrNotConnected), or no // mutation responder accepted it. TransportUnavailable TransportOutcome = "unavailable" // TransportDeadline proves the context ended before request delivery. TransportDeadline TransportOutcome = "deadline" // TransportCommitUnknown reports delivery without a valid mutation reply. TransportCommitUnknown TransportOutcome = "commit_unknown" )