plogproto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default path to listen on / connect to.
	DefaultSock = "/run/plog/plog-packet.sock"
)

Variables

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

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
)

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
}

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)

Call 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.ReadCloser
	Seqpacket bool
}

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

func NewReader

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

Creates a new reader for plog messages.

func (*Reader) Receive

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

Overwrite *msg with a message received from the connection.

type Writer

type Writer struct {
	io.WriteCloser
	Seqpacket bool
	sync.Mutex
}

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

func NewClientConn

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

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

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

Convenienc wrapper for sending only the close message.

func (*Writer) SendKeyValue

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

Convenience wrapper for sending a single message.

func (*Writer) SendMessage

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

Convenience wrapper for sending only message messages.

func (*Writer) SendOpen

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

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