Commit 817f24a9 authored by Geoff Simmons's avatar Geoff Simmons

Declare constants so that go doc groups them with their types.

Makes the docs a bit less wordy.
parent d32f3803
......@@ -47,11 +47,14 @@ import (
"unsafe"
)
// Possible values for type TxType, which classifies a log
// transaction.
// TxType is a classifier for a log transaction, indicating if it is
// the log of a client or backend request/response, a Varnish session,
// or a raw transaction.
type TxType uint8
const (
// Unknown transaction type.
TxUnknown = TxType(C.VSL_t_unknown)
TxUnknown TxType = TxType(C.VSL_t_unknown)
// The log of a session, which stands for the "conversation"
// that Varnish has with a single client connection,
......@@ -69,12 +72,6 @@ const (
TxRaw = TxType(C.VSL_t_raw)
)
// TxType is a classifier for a log transaction, indicating if it is
// the log of a client or backend request/response, a Varnish session,
// or a raw transaction. Possible values for TxType are shown in the
// constants above.
type TxType uint8
// String returns the string for a TxType that appears in the "title"
// line of a log transaction in varnishlog output.
func (txtype TxType) String() string {
......@@ -94,11 +91,12 @@ func (txtype TxType) String() string {
}
}
// Possible values for a Reason, which classifies the cause of the
// event that was logged.
// Reason is a classifier for the cause of the event that was logged.
type Reason uint8
const (
// Unknown reason.
ReasonUnknown = Reason(C.VSL_r_unknown)
ReasonUnknown Reason = Reason(C.VSL_r_unknown)
// The start of an HTTP/1 session.
HTTP1 = Reason(C.VSL_r_http_1)
......@@ -127,10 +125,6 @@ const (
Pipe = Reason(C.VSL_r_pipe)
)
// Reason is a classifier for the cause of the event that was logged.
// Possible values for Reason are shown in the constants above.
type Reason uint8
// String returns the string for a Reason that appears as the third
// field of a "Begin" record in varnishlog output (except for raw
// transactions).
......@@ -159,16 +153,18 @@ func (reason Reason) String() string {
}
}
// Possible values for a Grouping, which indicates how transactions
// are aggregated when read from the log. The default Grouping is
// VXID.
// Grouping mode determines how transactions are aggregated when read
// from the log. Depending on the mode, transactions in a group may
// form a hierarchy. The default Grouping is VXID.
type Grouping uint8
const (
// Transactions are not grouped, nor are records grouped into
// transactions -- every transaction has exactly one
// record. Records unrelated to requests, responses and
// sessions, such as backend health checks, are only reported
// in this mode.
GRaw = Grouping(C.VSL_g_raw)
GRaw Grouping = Grouping(C.VSL_g_raw)
// In the default mode, transactions are not grouped -- each
// read returns one transaction for a request/response (client
......@@ -189,18 +185,16 @@ const (
Session = Grouping(C.VSL_g_session)
)
// Grouping mode determines how transactions are aggregated when read
// from the log. Depending on the mode, transactions in a group may
// form a hierarchy. Possible values for Grouping are shown in the
// constants above. The default Grouping is VXID.
type Grouping uint8
// RecordType is a classifier for the data in a Record, indicating if
// it is part of the log for a client request/response, a backend
// request/repsonse, or neither. Corresponds to the indicator 'b',
// 'c' or '-' in the fourth column of verbose varnishlog output.
type RecordType uint8
// Possible values for RecordType, which classifies the data in a
// Record.
const (
// The Record is part of the log for a client
// request/response.
Client = RecordType('c')
Client RecordType = RecordType('c')
// Part of the log for a backend request/response.
Backend = RecordType('b')
......@@ -211,14 +205,6 @@ const (
None = RecordType('-')
)
// RecordType is a classifier for the data in a Record, indicating if
// it is part of the log for a client request/response, a backend
// request/repsonse, or neither. Corresponds to the indicator 'b',
// 'c' or '-' in the fourth column of verbose varnishlog
// output. Possible values for RecordType are shown in the constants
// above.
type RecordType uint8
func initTags() []string {
var tags []string
if uint8(C.slt_max()) > ^uint8(0) {
......@@ -571,11 +557,13 @@ func publish(trans unsafe.Pointer, priv unsafe.Pointer) C.int {
return C.int(Stopped)
}
// Possible values for a Status, indicating the current status of a
// Varnish log read sequence.
// Status classifies the current state of a log read sequence. A value
// of this type is passed to the read callback used by a Read method.
type Status int8
const (
// Write error.
WriteErr = Status(C.vsl_e_write)
WriteErr Status = Status(C.vsl_e_write)
// IO error while reading.
IOErr = Status(C.vsl_e_io)
......@@ -603,12 +591,6 @@ const (
Stopped = More + 1
)
// Status classifies the current state of a log read sequence. A value
// of this type is passed to the read callback used by a Read
// method. Possible values for Status are shown in the constants
// above.
type Status int8
// String returns a string describing the Status.
func (status Status) String() string {
switch status {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment