common

package
v0.0.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0, AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SpoolIDSize is the size of a spool identity
	SpoolIDSize = 12

	// SignatureSize is the size of a spool command signature
	SignatureSize = 64

	// PublicKeySize is the size of a public key for verifying
	// spool command signatures.
	PublicKeySize = 32

	// MessageIDSize is the size of a message identity.
	MessageIDSize = 4

	// ResponsePadding is size of the padding of the spool service response.
	ResponsePadding = 171

	// QueryOverhead is the number of bytes overhead
	// from the spool command CBOR encoding.
	QueryOverhead = 171

	// CreateSpoolCommand is the identity of the create spool command.
	CreateSpoolCommand = 0

	// PurgeSpoolCommand is the identity of the purge spool command.
	PurgeSpoolCommand = 1

	// AppendMessageCommand is the identity of the append message command.
	AppendMessageCommand = 2

	// RetrieveMessageCommand is the identity of the retrieve message command.
	RetrieveMessageCommand = 3

	// SpoolServiceName is the canonical name of the memspool service.
	SpoolServiceName = "spool"

	// StatusOK is a status string indicating there was no error on the spool operation.
	StatusOK = "OK"
)

Variables

This section is empty.

Functions

func AppendToSpool

func AppendToSpool(spoolID [SpoolIDSize]byte, message []byte, geo *geo.Geometry) ([]byte, error)

func CreateSpool

func CreateSpool(privKey sign.PrivateKey) ([]byte, error)

func PurgeSpool

func PurgeSpool(spoolID [SpoolIDSize]byte, privKey sign.PrivateKey) ([]byte, error)

func ReadFromSpool

func ReadFromSpool(spoolID [SpoolIDSize]byte, messageID uint32, privKey sign.PrivateKey) ([]byte, error)

func SpoolPayloadLength

func SpoolPayloadLength(geo *geo.Geometry) int

Types

type SpoolRequest

type SpoolRequest struct {
	Command byte

	// SpoolID identities a spool on a particular Provider host.
	// This field must be SpoolIDSize bytes long.
	SpoolID   [SpoolIDSize]byte
	Signature []byte
	PublicKey []byte
	MessageID uint32
	Message   []byte
}

SpoolRequest is the message sent to the spool server

func (*SpoolRequest) Marshal

func (s *SpoolRequest) Marshal() ([]byte, error)

Marshal implements cborplugin.Command

func (*SpoolRequest) Unmarshal

func (s *SpoolRequest) Unmarshal(b []byte) error

Unmarshal implements cborplugin.Command

type SpoolResponse

type SpoolResponse struct {
	SpoolID   [SpoolIDSize]byte
	MessageID uint32
	Message   []byte
	Status    string
}

SpoolResponse is the response message from the spool server

func (*SpoolResponse) IsOK

func (s *SpoolResponse) IsOK() bool

func (*SpoolResponse) Marshal

func (s *SpoolResponse) Marshal() ([]byte, error)

Marshal implements cborplugin.Command

func (*SpoolResponse) StatusAsError

func (s *SpoolResponse) StatusAsError() error

func (*SpoolResponse) Unmarshal

func (s *SpoolResponse) Unmarshal(b []byte) error

Unmarshal implements cborplugin.Command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL