Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptsCompressedEnvelope(accept string) bool
- func CanonicalizeForProject(payload []byte, project string) ([]byte, error)
- func ChunkID(payload []byte) string
- func CompressedEnvelopeContentType() string
- func DecodeCompressedEnvelope(payload []byte, maxBytes int64) ([]byte, error)
- func DecodeSyncMutationPayload(payload string, dest any) error
- func EncodeCompressedEnvelope(payload []byte) ([]byte, error)
- func IsCompressedEnvelopeContentType(contentType string) (bool, error)
- func ValidateRelationPayload(payload json.RawMessage) (string, bool)
Constants ¶
const ( // CompressedEnvelopeMediaType identifies the versioned compressed chunk transport. // It reduces false-positive inspection of sync payloads; it does not provide secrecy. CompressedEnvelopeMediaType = "application/vnd.engram.sync+gzip" // DefaultMaxDecodedBytes bounds decompression when a peer does not provide a // negotiated payload limit. It matches the default cloud push body limit. DefaultMaxDecodedBytes int64 = 8 * 1024 * 1024 )
Variables ¶
var ( ErrPayloadTooLarge = errors.New("compressed payload exceeds decoded size limit") ErrUnsupportedEnvelopeVersion = errors.New("unsupported compressed envelope version") )
Functions ¶
func AcceptsCompressedEnvelope ¶
AcceptsCompressedEnvelope reports whether an Accept header advertises the supported envelope. Requests without that explicit advertisement receive legacy JSON.
func CanonicalizeForProject ¶
func CompressedEnvelopeContentType ¶
func CompressedEnvelopeContentType() string
CompressedEnvelopeContentType returns the exact media type for the supported envelope.
func DecodeCompressedEnvelope ¶
DecodeCompressedEnvelope decodes a gzip envelope and refuses decoded payloads that exceed maxBytes, preventing compressed inputs from bypassing request body limits.
func EncodeCompressedEnvelope ¶
EncodeCompressedEnvelope gzip-compresses a canonical JSON payload for transport.
func IsCompressedEnvelopeContentType ¶
IsCompressedEnvelopeContentType reports whether contentType is the supported envelope. A recognized envelope media type with another version is rejected rather than decoded as legacy JSON.
func ValidateRelationPayload ¶
func ValidateRelationPayload(payload json.RawMessage) (string, bool)
ValidateRelationPayload reports the first required relation payload field that is absent, not a string, or empty after trimming whitespace.
Types ¶
This section is empty.