cmds

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode[M any, P pb.Pointer[M], T pb.Unmarshaler[P]](b []byte, cmd Command, v T) ([]byte, error)

func DecodePB

func DecodePB(b []byte, cmd Command, v proto.Message) ([]byte, error)

func Encode

func Encode[M any, P pb.Pointer[M], T pb.Marshaler[P]](b []byte, cmd Command, v T) ([]byte, error)

func EncodePB

func EncodePB(b []byte, cmd Command, msg proto.Message) ([]byte, error)

Types

type Command

type Command uint16
const (
	ClusterAddNode    Command = 1
	ClusterRemoveNode Command = 2
	ClusterStatus     Command = 3
	ClusterEdit       Command = 4

	EnclaveCreate Command = 101
	EnclaveDelete Command = 102
	EnclaveStatus Command = 103
	EnclaveList   Command = 104

	KeyCreate       Command = 201
	KeyDelete       Command = 202
	KeyImport       Command = 203
	KeyStatus       Command = 204
	KeyEncrypt      Command = 205
	KeyDecrypt      Command = 206
	KeyGenerate     Command = 207
	KeyList         Command = 208
	KeyListVersions Command = 209

	PolicyCreate Command = 301
	PolicyDelete Command = 302
	PolicyAssign Command = 303
	PolicyGet    Command = 304
	PolicyStatus Command = 305
	PolicyList   Command = 306

	IdentityCreate Command = 401
	IdentityDelete Command = 402
	IdentityGet    Command = 403
	IdentityList   Command = 404
)

func Parse

func Parse(s string) (Command, error)

func (Command) AppendText

func (c Command) AppendText(b []byte) ([]byte, error)

func (Command) IsWrite

func (c Command) IsWrite() bool

IsWrite reports whether c changes state on the server.

A server may choose to not accept multiple commands within a single request that do and do not change the server's state, and instead, requires that clients either send "read-only" or "write-only" commands.

func (Command) MarshalText

func (c Command) MarshalText() ([]byte, error)

func (Command) String

func (c Command) String() string

func (*Command) UnmarshalText

func (c *Command) UnmarshalText(text []byte) error

type DecodeError

type DecodeError struct {
	Cmd  Command
	Len  int
	Data []byte
	Type reflect.Type
	// contains filtered or unexported fields
}

func (*DecodeError) Error

func (e *DecodeError) Error() string

Jump to

Keyboard shortcuts

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