plogproto

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSock is the default path to listen on / connect to.
	DefaultSock = "/run/plog/plog.sock"
)

Variables

View Source
var CtxType_name = map[int32]string{
	0: "log",
	1: "state",
	2: "count",
	3: "dict",
	4: "list",
	5: "list_of_dicts",
}
View Source
var CtxType_value = map[string]int32{
	"log":           0,
	"state":         1,
	"count":         2,
	"dict":          3,
	"list":          4,
	"list_of_dicts": 5,
}

Functions

This section is empty.

Types

type CtxType

type CtxType int32
const (
	CtxType_log           CtxType = 0
	CtxType_state         CtxType = 1
	CtxType_count         CtxType = 2
	CtxType_dict          CtxType = 3
	CtxType_list          CtxType = 4
	CtxType_list_of_dicts CtxType = 5
)

func (CtxType) Enum

func (x CtxType) Enum() *CtxType

func (CtxType) EnumDescriptor

func (CtxType) EnumDescriptor() ([]byte, []int)

func (CtxType) String

func (x CtxType) String() string

func (*CtxType) UnmarshalJSON

func (x *CtxType) UnmarshalJSON(data []byte) error

type Listener

type Listener struct {
	net.Listener
	Seqpacket bool
}

Listener is a convenience listener type. Set seqpacket to true in case that's the socket type used.

func (Listener) Accept

func (l Listener) Accept() (*Reader, error)

Accept on the contained listener and wrap the returned connection.

type OpenContext

type OpenContext struct {
	Ctxtype              *CtxType `protobuf:"varint,1,opt,name=ctxtype,enum=plogproto.CtxType" json:"ctxtype,omitempty"`
	Key                  []string `protobuf:"bytes,2,rep,name=key" json:"key,omitempty"`
	ParentCtxId          *uint64  `protobuf:"varint,3,opt,name=parent_ctx_id,json=parentCtxId" json:"parent_ctx_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*OpenContext) Descriptor

func (*OpenContext) Descriptor() ([]byte, []int)

func (*OpenContext) GetCtxtype

func (m *OpenContext) GetCtxtype() CtxType

func (*OpenContext) GetKey

func (m *OpenContext) GetKey() []string

func (*OpenContext) GetParentCtxId

func (m *OpenContext) GetParentCtxId() uint64

func (*OpenContext) ProtoMessage

func (*OpenContext) ProtoMessage()

func (*OpenContext) Reset

func (m *OpenContext) Reset()

func (*OpenContext) String

func (m *OpenContext) String() string

func (*OpenContext) XXX_DiscardUnknown

func (m *OpenContext) XXX_DiscardUnknown()

func (*OpenContext) XXX_Marshal

func (m *OpenContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*OpenContext) XXX_Merge

func (dst *OpenContext) XXX_Merge(src proto.Message)

func (*OpenContext) XXX_Size

func (m *OpenContext) XXX_Size() int

func (*OpenContext) XXX_Unmarshal

func (m *OpenContext) XXX_Unmarshal(b []byte) error

type Plog

type Plog struct {
	CtxId *uint64 `protobuf:"varint,1,opt,name=ctx_id,json=ctxId" json:"ctx_id,omitempty"`
	// All these are optional, more than one can be set.
	// E.g. all three can be used together to send a whole context in a single message.
	Open                 *OpenContext   `protobuf:"bytes,2,opt,name=open" json:"open,omitempty"`
	Msg                  []*PlogMessage `protobuf:"bytes,3,rep,name=msg" json:"msg,omitempty"`
	Close                *bool          `protobuf:"varint,4,opt,name=close" json:"close,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*Plog) Descriptor

func (*Plog) Descriptor() ([]byte, []int)

func (*Plog) GetClose

func (m *Plog) GetClose() bool

func (*Plog) GetCtxId

func (m *Plog) GetCtxId() uint64

func (*Plog) GetMsg

func (m *Plog) GetMsg() []*PlogMessage

func (*Plog) GetOpen

func (m *Plog) GetOpen() *OpenContext

func (*Plog) ProtoMessage

func (*Plog) ProtoMessage()

func (*Plog) Reset

func (m *Plog) Reset()

func (*Plog) String

func (m *Plog) String() string

func (*Plog) XXX_DiscardUnknown

func (m *Plog) XXX_DiscardUnknown()

func (*Plog) XXX_Marshal

func (m *Plog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Plog) XXX_Merge

func (dst *Plog) XXX_Merge(src proto.Message)

func (*Plog) XXX_Size

func (m *Plog) XXX_Size() int

func (*Plog) XXX_Unmarshal

func (m *Plog) XXX_Unmarshal(b []byte) error

type PlogMessage

type PlogMessage struct {
	Key                  *string  `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
	Value                []byte   `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*PlogMessage) Descriptor

func (*PlogMessage) Descriptor() ([]byte, []int)

func (*PlogMessage) GetKey

func (m *PlogMessage) GetKey() string

func (*PlogMessage) GetValue

func (m *PlogMessage) GetValue() []byte

func (*PlogMessage) ProtoMessage

func (*PlogMessage) ProtoMessage()

func (*PlogMessage) Reset

func (m *PlogMessage) Reset()

func (*PlogMessage) String

func (m *PlogMessage) String() string

func (*PlogMessage) XXX_DiscardUnknown

func (m *PlogMessage) XXX_DiscardUnknown()

func (*PlogMessage) XXX_Marshal

func (m *PlogMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlogMessage) XXX_Merge

func (dst *PlogMessage) XXX_Merge(src proto.Message)

func (*PlogMessage) XXX_Size

func (m *PlogMessage) XXX_Size() int

func (*PlogMessage) XXX_Unmarshal

func (m *PlogMessage) XXX_Unmarshal(b []byte) error

type Reader

type Reader struct {
	io.Closer
	Seqpacket bool
	// contains filtered or unexported fields
}

Reader for receiving plog messages. Has Closer for easier use.

func NewReader

func NewReader(rc io.ReadCloser, seqpacket bool) *Reader

NewReader creates a new reader for plog messages.

func (*Reader) Receive

func (r *Reader) Receive(msg *Plog) error

Receive overwrites *msg with a message received from the connection.

type Writer

type Writer struct {
	io.Closer
	Seqpacket bool
	sync.Mutex
	// contains filtered or unexported fields
}

Writer for sending plog messages. Has closer for easier use.

func NewClientConn

func NewClientConn(sock string) (*Writer, error)

NewClientConn parses sock either as a URL or a path and opens a connection there. If sock is empty string the DefaultSock value is used. The underlying WriteCloser can be cast to net.Conn if necessary.

func NewWriter

func NewWriter(wc io.WriteCloser, seqpacket bool) *Writer

NewWriter creates a new writer for plog messages.

func (*Writer) Send

func (w *Writer) Send(msg *Plog) error

Send *msg on the connection.

func (*Writer) SendClose

func (w *Writer) SendClose(ctxID uint64) error

SendClose is a convenience wrapper for sending only the close message.

func (*Writer) SendKeyValue

func (w *Writer) SendKeyValue(ctxID uint64, key string, value []byte) error

SendKeyValue is a convenience wrapper for sending a single message.

func (*Writer) SendMessage

func (w *Writer) SendMessage(ctxID uint64, msg ...*PlogMessage) error

SendMessage is a convenience wrapper for sending only message messages.

func (*Writer) SendOpen

func (w *Writer) SendOpen(ctxID uint64, msg *OpenContext) error

SendOpen is a convenience wrapper for sending only the open message.

Jump to

Keyboard shortcuts

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