Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) IsLogName(ctx context.Context, name string) (bool, error)
- func (c *Client) LogNames(ctx context.Context) ([]string, error)
- func (c *Client) LogNamesWithMatches(ctx context.Context, cond monitor.NameMatches) ([]string, error)
- func (c *Client) Stream(ctx context.Context, name string, start *monitor.Time, finish *monitor.Time) (monitor.Iterator, error)
- func (c *Client) StreamWithMatches(ctx context.Context, name string, start *monitor.Time, finish *monitor.Time, ...) (monitor.Iterator, error)
- type ClientConfig
- type Option
- type Server
Constants ¶
const ( DefaultTCPPort = 12357 DefaultWSPort = 80 )
The default ports that monitord listens on.
Variables ¶
var ( ErrNilConfiguration = errors.New("illegal nil configuration data") ErrPortOutOfRange = errors.New("the port number must be between 1 and 65535") )
Common errors
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { log.BasicLogable io.Closer // contains filtered or unexported fields }
Client is the client-view of the server.
func NewClient ¶
func NewClient(ctx context.Context, cfg *ClientConfig) (*Client, error)
NewClient returns a new client-view of the server specified by the configuration cfg.
func (*Client) LogNamesWithMatches ¶
func (c *Client) LogNamesWithMatches(ctx context.Context, cond monitor.NameMatches) ([]string, error)
LogNamesWithMatches is the same as LogNames, with the exception that log names are filtered against the conditions 'cond'.
func (*Client) Stream ¶
func (c *Client) Stream(ctx context.Context, name string, start *monitor.Time, finish *monitor.Time) (monitor.Iterator, error)
Stream returns an iterator down which entries from the log 'name' are passed. Only entries falling into the range determined by start and finish will be returned. If start is unassigned then the start of the log will be used; if end is unassigned then no end is used. The caller should ensure that the returned Iterator is closed, otherwise a resource leak will result.
func (*Client) StreamWithMatches ¶
func (c *Client) StreamWithMatches(ctx context.Context, name string, start *monitor.Time, finish *monitor.Time, cond monitor.Matches) (monitor.Iterator, error)
StreamWithMatches is the same as Stream, with the exception that entries are filtered against the conditions 'cond'.
type ClientConfig ¶
type ClientConfig struct { Address *address.Address // The address to connect to SSLDisabled bool // Disable SSL? SSLCert []byte // The SSL certificate (if any) }
ClientConfig describes the configuration options we allow a user to set on a client connection.
func DefaultConfig ¶
func DefaultConfig() *ClientConfig
DefaultConfig returns a new client configuration initialised with the default values.
The initial default value for the host and port will be read from the environment variable
PCAS_MONITOR_ADDRESS = "hostname[:port]" or "ws://host/path"
on package init.
func SetDefaultConfig ¶
func SetDefaultConfig(c *ClientConfig) *ClientConfig
SetDefaultConfig sets the default client configuration to c and returns the old default configuration. This change will be reflected in future calls to DefaultConfig.
func (*ClientConfig) Copy ¶
func (c *ClientConfig) Copy() *ClientConfig
Copy returns a copy of the configuration.
func (*ClientConfig) URI ¶
func (c *ClientConfig) URI() string
URI returns the URI connection string.
Note that the returned string may differ slightly from the value returned c.Address.URI(). For example, if c.Address omits a port number, an appropriate default port number is used here.
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate validates the client configuration, returning an error if there's a problem.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option sets options on a server.
func Connection ¶
func Connection(c monitor.Connection) Option
Connection is the connection from which log messages will be read.
func SSLCertAndKey ¶
SSLCertAndKey adds the given SSL public certificate and private key to the server.