Documentation ¶
Overview ¶
Package webtail holds tailer service You don't need anything except Service methods
Index ¶
- Constants
- func FileServer(path string) http.Handler
- type Client
- type Config
- type Hub
- type InMessage
- type IndexItemAttr
- type IndexItemAttrStore
- type IndexItemEvent
- type IndexMessage
- type Message
- type Service
- type StatsMessage
- type TailAttr
- type TailMessage
- type TailService
- func (ts *TailService) ChannelExists(channel string) bool
- func (ts *TailService) IndexItem(key string) *IndexItemAttr
- func (ts *TailService) IndexKeys() []string
- func (ts *TailService) IndexUpdate(msg *IndexItemEvent)
- func (ts *TailService) IndexerRun(out chan *IndexItemEvent, wg *sync.WaitGroup)
- func (ts *TailService) SetTrace(mode string)
- func (ts *TailService) TailerAppend(channel string, data []byte) bool
- func (ts *TailService) TailerBuffer(channel string) [][]byte
- func (ts *TailService) TailerRun(channel string, out chan *TailMessage, readyChan chan struct{}, ...) error
- func (ts *TailService) TraceEnabled() bool
- func (ts *TailService) WorkerExists(channel string) bool
- func (ts *TailService) WorkerStop(channel string)
- type TraceMessage
Constants ¶
const ( MsgSubscribed = "success" MsgUnSubscribed = "success" MsgUnknownChannel = "unknown channel" MsgNotSubscribed = "not subscribed" MsgWorkerError = "worker create error" MsgSubscribedAlready = "attached already" MsgNone = "" )
Returned Messages
Variables ¶
This section is empty.
Functions ¶
func FileServer ¶ added in v0.46.0
FileServer return embedded or given fs
Types ¶
type Client ¶ added in v0.43.1
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type Config ¶
type Config struct { Root string `long:"root" default:"log/" description:"Root directory for log files"` Bytes int64 `long:"bytes" default:"5000" description:"tail from the last Nth location"` Lines int `long:"lines" default:"100" description:"keep N old lines for new consumers"` MaxLineSize int `long:"split" default:"180" description:"split line if longer"` ListCache int `long:"cache" default:"2" description:"Time to cache file listing (sec)"` Poll bool `long:"poll" description:"use polling, instead of inotify"` Trace bool `long:"trace" description:"trace worker channels"` ClientBufferSize int `long:"out_buf" default:"256" description:"Client Buffer Size"` WSReadBufferSize int `long:"ws_read_buf" default:"1024" description:"WS Read Buffer Size"` WSWriteBufferSize int `long:"ws_write_buf" default:"1024" description:"WS Write Buffer Size"` }
Config defines local application flags
type Hub ¶ added in v0.43.1
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to them
type IndexItemAttr ¶ added in v0.44.0
IndexItemAttr holds File (index item) Attrs
type IndexItemAttrStore ¶ added in v0.44.0
type IndexItemAttrStore map[string]*IndexItemAttr
IndexItemAttrStore holds all index items
type IndexItemEvent ¶ added in v0.44.0
type IndexItemEvent struct { ModTime time.Time `json:"mtime"` Size int64 `json:"size"` Name string `json:"name"` Deleted bool `json:"deleted,omitempty"` }
IndexItemEvent holds messages from indexer
type IndexMessage ¶ added in v0.45.0
type IndexMessage struct { Type string `json:"type"` Data IndexItemEvent `json:"data"` Error string `json:"error,omitempty"` }
IndexMessage holds outgoing message item for file index
type Service ¶ added in v0.43.1
type Service struct {
// contains filtered or unexported fields
}
Service holds WebTail service
type StatsMessage ¶ added in v0.45.0
type StatsMessage struct { Type string `json:"type"` Data map[string]uint64 `json:"data,omitempty"` }
StatsMessage holds outgoing app stats
type TailAttr ¶ added in v0.45.0
type TailAttr struct { // Store for last Config.Lines lines Buffer [][]byte // Quit worker process Quit chan struct{} // Skip 1st line when read file not from start IsHeadTrimmed bool }
TailAttr holds tail worker attributes
type TailMessage ¶ added in v0.45.0
type TailMessage struct { Type string `json:"type"` Channel string `json:"channel,omitempty"` Data string `json:"data,omitempty"` }
TailMessage holds outgoing file tail row
type TailService ¶ added in v0.45.0
type TailService struct { Config *Config // contains filtered or unexported fields }
TailService holds Worker hub operations
func NewTailService ¶ added in v0.45.0
func NewTailService(logger logr.Logger, cfg *Config) (*TailService, error)
NewTailService creates tailer service
func (*TailService) ChannelExists ¶ added in v0.45.0
func (ts *TailService) ChannelExists(channel string) bool
ChannelExists checks if channel allowed to attach
func (*TailService) IndexItem ¶ added in v0.45.0
func (ts *TailService) IndexItem(key string) *IndexItemAttr
IndexItem returns index item
func (*TailService) IndexKeys ¶ added in v0.45.0
func (ts *TailService) IndexKeys() []string
IndexKeys returns sorted index keys
func (*TailService) IndexUpdate ¶ added in v0.45.0
func (ts *TailService) IndexUpdate(msg *IndexItemEvent)
IndexUpdate updates TailService index item
func (*TailService) IndexerRun ¶ added in v0.45.0
func (ts *TailService) IndexerRun(out chan *IndexItemEvent, wg *sync.WaitGroup)
IndexerRun runs indexer
func (*TailService) SetTrace ¶ added in v0.45.0
func (ts *TailService) SetTrace(mode string)
SetTrace turns on/off logging of incoming workers messages
func (*TailService) TailerAppend ¶ added in v0.45.0
func (ts *TailService) TailerAppend(channel string, data []byte) bool
TailerAppend adds a line into worker buffer
func (*TailService) TailerBuffer ¶ added in v0.45.0
func (ts *TailService) TailerBuffer(channel string) [][]byte
TailerBuffer returns worker buffer
func (*TailService) TailerRun ¶ added in v0.45.0
func (ts *TailService) TailerRun(channel string, out chan *TailMessage, readyChan chan struct{}, wg *sync.WaitGroup) error
TailerRun creates and runs tail worker
func (*TailService) TraceEnabled ¶ added in v0.45.0
func (ts *TailService) TraceEnabled() bool
TraceEnabled returns trace state
func (*TailService) WorkerExists ¶ added in v0.45.0
func (ts *TailService) WorkerExists(channel string) bool
WorkerExists checks if worker already registered
func (*TailService) WorkerStop ¶ added in v0.45.0
func (ts *TailService) WorkerStop(channel string)
WorkerStop stops worker (tailer or indexer)
type TraceMessage ¶ added in v0.45.0
TraceMessage holds outgoing trace state