Documentation
¶
Overview ¶
Package protocol defines the JSON contract between Questlock and its clients.
Index ¶
Constants ¶
const ( ExpectedAuthorityHeader = "X-Questlock-Expected-Authority" ExpectedScopeHeader = "X-Questlock-Expected-Scope" ExpectedAgentHeader = "X-Questlock-Expected-Agent" )
const ( MaxSyncItems = 128 MaxSyncBytes = 8 << 20 MinSyncBytes = 4096 MaxSyncCursorBytes = 2048 MaxSyncRequestBytes = 4096 )
const MaxContentBytes = 1 << 20
Variables ¶
This section is empty.
Functions ¶
func DecodeDataJSON ¶ added in v0.9.0
DecodeDataJSON preserves case-sensitive application data (for example a json_equals expectation) while requiring exact struct field names. Callers impose their byte bound. This does not relax the sync wire format.
func DecodeSyncJSON ¶ added in v0.8.0
DecodeSyncJSON strictly decodes a bounded object; callers set the byte limit. Nested duplicate members, malformed UTF-8, unknown struct fields, trailing values and excessive nesting are rejected.
Types ¶
type AuditEvent ¶
type AuditEvent struct {
ID int64 `json:"id"`
AgentID string `json:"agent_id"`
Scope string `json:"scope"`
Key string `json:"key"`
OperationID string `json:"operation_id"`
Outcome string `json:"outcome"`
ExpectedVersion int64 `json:"expected_version"`
CurrentVersion int64 `json:"current_version"`
CreatedAt string `json:"created_at"`
}
type Identity ¶ added in v0.8.0
type Identity struct {
Authority string `json:"authority"`
Scope string `json:"scope"`
AgentID string `json:"agent_id"`
}
Identity is authenticated server evidence, not authority supplied by a writer. AgentID matters because successful operation IDs are namespaced by agent.
type PublishRequest ¶
type PublishResult ¶
type SyncEntry ¶ added in v0.8.0
SyncEntry contains raw immutable artifact content. Sequence is an accepted publication ID, never a client-writable version or scope-wide CAS version.
type SyncPage ¶ added in v0.8.0
type SyncPage struct {
Authority string `json:"authority"`
Scope string `json:"scope"`
Kind string `json:"kind"`
Through int64 `json:"through"`
Entries []SyncEntry `json:"entries"`
Cursor string `json:"cursor"`
HasMore bool `json:"has_more"`
}
func DecodeSyncPage ¶ added in v0.8.0
DecodeSyncPage requires every canonical response field, including false, zero, and intentionally empty content. Omission/null is never a default. Semantic scope, sequence, and requested-limit checks remain with the client.
type SyncRequest ¶ added in v0.8.0
type SyncRequest struct {
Cursor string `json:"cursor,omitempty"`
Limit int `json:"limit,omitempty"`
MaxBytes int `json:"max_bytes,omitempty"`
}
SyncRequest requests read-only pages in the token's scope. Zero limits select defaults. Cursor is opaque; persist it without editing. No writes are accepted.
func DecodeSyncRequest ¶ added in v0.8.0
func DecodeSyncRequest(data []byte) (SyncRequest, error)
DecodeSyncRequest rejects unknown, duplicate, null and trailing fields.
func (SyncRequest) Bounds ¶ added in v0.8.0
func (r SyncRequest) Bounds() (SyncRequest, error)