Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishapi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishapi
Commits
817f24a9
Commit
817f24a9
authored
Aug 11, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare constants so that go doc groups them with their types.
Makes the docs a bit less wordy.
parent
d32f3803
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
45 deletions
+27
-45
log.go
pkg/log/log.go
+27
-45
No files found.
pkg/log/log.go
View file @
817f24a9
...
@@ -47,11 +47,14 @@ import (
...
@@ -47,11 +47,14 @@ import (
"unsafe"
"unsafe"
)
)
// Possible values for type TxType, which classifies a log
// TxType is a classifier for a log transaction, indicating if it is
// transaction.
// the log of a client or backend request/response, a Varnish session,
// or a raw transaction.
type
TxType
uint8
const
(
const
(
// Unknown transaction type.
// 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"
// The log of a session, which stands for the "conversation"
// that Varnish has with a single client connection,
// that Varnish has with a single client connection,
...
@@ -69,12 +72,6 @@ const (
...
@@ -69,12 +72,6 @@ const (
TxRaw
=
TxType
(
C
.
VSL_t_raw
)
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"
// String returns the string for a TxType that appears in the "title"
// line of a log transaction in varnishlog output.
// line of a log transaction in varnishlog output.
func
(
txtype
TxType
)
String
()
string
{
func
(
txtype
TxType
)
String
()
string
{
...
@@ -94,11 +91,12 @@ 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
// Reason is a classifier for the cause of the event that was logged.
// event that was logged.
type
Reason
uint8
const
(
const
(
// Unknown reason.
// Unknown reason.
ReasonUnknown
=
Reason
(
C
.
VSL_r_unknown
)
ReasonUnknown
Reason
=
Reason
(
C
.
VSL_r_unknown
)
// The start of an HTTP/1 session.
// The start of an HTTP/1 session.
HTTP1
=
Reason
(
C
.
VSL_r_http_1
)
HTTP1
=
Reason
(
C
.
VSL_r_http_1
)
...
@@ -127,10 +125,6 @@ const (
...
@@ -127,10 +125,6 @@ const (
Pipe
=
Reason
(
C
.
VSL_r_pipe
)
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
// String returns the string for a Reason that appears as the third
// field of a "Begin" record in varnishlog output (except for raw
// field of a "Begin" record in varnishlog output (except for raw
// transactions).
// transactions).
...
@@ -159,16 +153,18 @@ func (reason Reason) String() string {
...
@@ -159,16 +153,18 @@ func (reason Reason) String() string {
}
}
}
}
// Possible values for a Grouping, which indicates how transactions
// Grouping mode determines how transactions are aggregated when read
// are aggregated when read from the log. The default Grouping is
// from the log. Depending on the mode, transactions in a group may
// VXID.
// form a hierarchy. The default Grouping is VXID.
type
Grouping
uint8
const
(
const
(
// Transactions are not grouped, nor are records grouped into
// Transactions are not grouped, nor are records grouped into
// transactions -- every transaction has exactly one
// transactions -- every transaction has exactly one
// record. Records unrelated to requests, responses and
// record. Records unrelated to requests, responses and
// sessions, such as backend health checks, are only reported
// sessions, such as backend health checks, are only reported
// in this mode.
// 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
// In the default mode, transactions are not grouped -- each
// read returns one transaction for a request/response (client
// read returns one transaction for a request/response (client
...
@@ -189,18 +185,16 @@ const (
...
@@ -189,18 +185,16 @@ const (
Session
=
Grouping
(
C
.
VSL_g_session
)
Session
=
Grouping
(
C
.
VSL_g_session
)
)
)
//
Grouping mode determines how transactions are aggregated when read
//
RecordType is a classifier for the data in a Record, indicating if
//
from the log. Depending on the mode, transactions in a group may
//
it is part of the log for a client request/response, a backend
//
form a hierarchy. Possible values for Grouping are shown in the
//
request/repsonse, or neither. Corresponds to the indicator 'b',
//
constants above. The default Grouping is VXID
.
//
'c' or '-' in the fourth column of verbose varnishlog output
.
type
Grouping
uint8
type
RecordType
uint8
// Possible values for RecordType, which classifies the data in a
// Record.
const
(
const
(
// The Record is part of the log for a client
// The Record is part of the log for a client
// request/response.
// request/response.
Client
=
RecordType
(
'c'
)
Client
RecordType
=
RecordType
(
'c'
)
// Part of the log for a backend request/response.
// Part of the log for a backend request/response.
Backend
=
RecordType
(
'b'
)
Backend
=
RecordType
(
'b'
)
...
@@ -211,14 +205,6 @@ const (
...
@@ -211,14 +205,6 @@ const (
None
=
RecordType
(
'-'
)
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
{
func
initTags
()
[]
string
{
var
tags
[]
string
var
tags
[]
string
if
uint8
(
C
.
slt_max
())
>
^
uint8
(
0
)
{
if
uint8
(
C
.
slt_max
())
>
^
uint8
(
0
)
{
...
@@ -571,11 +557,13 @@ func publish(trans unsafe.Pointer, priv unsafe.Pointer) C.int {
...
@@ -571,11 +557,13 @@ func publish(trans unsafe.Pointer, priv unsafe.Pointer) C.int {
return
C
.
int
(
Stopped
)
return
C
.
int
(
Stopped
)
}
}
// Possible values for a Status, indicating the current status of a
// Status classifies the current state of a log read sequence. A value
// Varnish log read sequence.
// of this type is passed to the read callback used by a Read method.
type
Status
int8
const
(
const
(
// Write error.
// Write error.
WriteErr
=
Status
(
C
.
vsl_e_write
)
WriteErr
Status
=
Status
(
C
.
vsl_e_write
)
// IO error while reading.
// IO error while reading.
IOErr
=
Status
(
C
.
vsl_e_io
)
IOErr
=
Status
(
C
.
vsl_e_io
)
...
@@ -603,12 +591,6 @@ const (
...
@@ -603,12 +591,6 @@ const (
Stopped
=
More
+
1
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.
// String returns a string describing the Status.
func
(
status
Status
)
String
()
string
{
func
(
status
Status
)
String
()
string
{
switch
status
{
switch
status
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment