lhproto

package
v0.0.0-...-6f42548 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2014 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//The body is a sequnce of IncomingLogEntryJSON terminated by \0.
	//<IncomingLogEntryJSON>\0<IncomingLogEntryJSON>\0...\0<IncomingLogEntryJSON>\0\0
	//
	//The message has no response.
	ActionWrite = "write"

	//The body is a sequence of LogQueryJSON terminated by \0.
	//<LogQueryJSON>\0<LogQueryJSON>\0...\0<LogQueryJSON>\0\0
	//
	//The response is a sequnce of OutgoingLogEntryJSON.
	//<OutgoingLogEntryJSON>\0<OutgoingLogEntryJSON>\0...\0<OutgoingLogEntryJSON>\0\0
	ActionRead = "read"

	//The body is a sequence of LogQueryJSON terminated by \0.
	//<LogQueryJSON>\0<LogQueryJSON>\0...\0<LogQueryJSON>\0\0
	//
	//The response is a sequnce of InternalLogEntryJSON.
	//<InternalLogEntryJSON>\0<InternalLogEntryJSON>\0...\0<InternalLogEntryJSON>\0\0
	ActionInternalRead = "iread"

	//The body is \0 terminated TruncateJSON.
	//The action has no response.
	ActionTruncate = "truncate"

	//The body is \0 terminated TransferJSON.
	ActionTransfer = "transfer"

	//The body is \0 terminated AcceptJSON followed by
	//a sequnce of InternalLogEntryJSON.
	//<AcceptJSON>\0<InternalLogEntryJSON>\0<InternalLogEntryJSON>\0...\0<InternalLogEntryJSON>\0\0
	//
	//The response is \0 terminated AcceptResultJSON.
	ActionAccept = "accept"

	//The body is a sequence of StatJSON terminated by \0.
	//<StatJSON>\0<StatJSON>\0...\0<StatJSON>\0\0
	ActionStat = "stat"

	//The body is \0 terminated UserInfoJSON.
	ActionUser = "user"

	//The body is \0 terminated PasswordJSON.
	ActionPassword = "pass"
)

Actions of the messages.

Variables

This section is empty.

Functions

func PurgeIncomingLogEntryJSON

func PurgeIncomingLogEntryJSON(entries chan *IncomingLogEntryJSON)

func PurgeInternalLogEntryJSON

func PurgeInternalLogEntryJSON(entries chan *InternalLogEntryJSON)

func PurgeLogQueryJSON

func PurgeLogQueryJSON(queries chan *LogQueryJSON)

func PurgeOutgoingLogEntryJSON

func PurgeOutgoingLogEntryJSON(entries chan *OutgoingLogEntryJSON)

Types

type AcceptJSON

type AcceptJSON struct {
	Chunk      string
	TransferId int64
}

The accept command.

type AcceptResultJSON

type AcceptResultJSON struct {
	Result bool
}

The result of 'accept' action.

type Credentials

type Credentials struct {
	User     string
	Password string
}

User credentials.

type IncomingLogEntryJSON

type IncomingLogEntryJSON struct {
	Sev int
	Src string

	//The message is always in plain text.
	//Compressing and decompressing of the messages is
	//the responsibility of the hub.
	Msg string
}

The log entries written by applications.

func (*IncomingLogEntryJSON) IsValid

func (m *IncomingLogEntryJSON) IsValid() bool

Validates the incoming message.

type InternalLogEntryJSON

type InternalLogEntryJSON struct {
	Sev int
	Src string
	Enc int

	//The value is base64 string if the Enc is EncodingDeflate;
	//if the End is EncodingPlain, then Msg is plain text.
	Msg string
	Ts  int64
}

The log entries for the internal communication.

type LogQueryJSON

type LogQueryJSON struct {
	From   int64
	To     int64
	MinSev int
	MaxSev int
	Src    string
}

The log query.

type MessageHeaderJSON

type MessageHeaderJSON struct {
	//The action to perform (one of Action... contants).
	//The action determines the structures of the body.
	Action string

	//Name of the user performing the operation.
	Usr string

	//Password of the user performing the operation.
	Pass string
}

The message header that each message starts with.

type OutgoingLogEntryJSON

type OutgoingLogEntryJSON struct {
	IncomingLogEntryJSON

	Ts int64
}

The log entries returned by the hub to its clients.

type PasswordJSON

type PasswordJSON struct {
	Password string
}

Password.

type ProtocolHandler

type ProtocolHandler interface {
	Write(*Credentials, chan *IncomingLogEntryJSON)
	Read(*Credentials, chan *LogQueryJSON, chan *OutgoingLogEntryJSON)
	InternalRead(*Credentials, chan *LogQueryJSON, chan *InternalLogEntryJSON)
	Truncate(*Credentials, *TruncateJSON)
	Transfer(*Credentials, *TransferJSON)
	Accept(*Credentials, *AcceptJSON, chan *InternalLogEntryJSON, chan *AcceptResultJSON)
	Stat(*Credentials, chan *StatJSON)
	User(*Credentials, *UserInfoJSON)
	Password(*Credentials, *PasswordJSON)
	Close()
}

The interface which a protocol handler must implement.

func NewClient

func NewClient(address string, connPoolSize int, useTLS bool, skipCertValidation bool) ProtocolHandler

type StatJSON

type StatJSON struct {
	Addr string
	Sz   int64
	Lim  int64
}

The result of 'stat' action.

type TransferJSON

type TransferJSON struct {
	Id   int64
	Addr string
	Lim  int64
}

The transfer command.

type TruncateJSON

type TruncateJSON struct {
	Src string
	Lim int64
}

The truncation command.

type UserInfoJSON

type UserInfoJSON struct {
	Name        string
	Password    string
	SetPassword bool
	Roles       []string
	Delete      bool
}

User data.

Jump to

Keyboard shortcuts

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