Documentation ¶
Index ¶
- Constants
- func PrintVersion()
- func ProcessBootTime() time.Time
- func StrftimeToGo(cFormat string) (goFormat string, err error)
- func SystemBootTime() (time.Time, error)
- type Daemon
- type DataDir
- type DataStore
- type DatabaseReader
- type DatabaseWriter
- type Event
- type EventReader
- type EventType
- type EventWriter
- type UnixTimestamp
Constants ¶
View Source
const ( DefaultTimeFormat = "%F %T" DefaultDataDir = "/var/lib/downtimed/" DefaultDBFile = "downtimedb" DefaultSleepSeconds = 15 )
View Source
const EventSize = 16
Variables ¶
This section is empty.
Functions ¶
func PrintVersion ¶
func PrintVersion()
func ProcessBootTime ¶
func StrftimeToGo ¶
StrftimeToGo converts a c-style strftime format string to the format expected by time.Time.Format()
func SystemBootTime ¶
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func NewDaemon ¶
func NewDaemon(dataStore DataStore, database EventWriter, sleep time.Duration) *Daemon
func NewDaemonWithClock ¶
type DatabaseReader ¶
type DatabaseReader struct {
// contains filtered or unexported fields
}
func NewDatabaseReader ¶
func NewDatabaseReader(reader io.ReadSeeker) *DatabaseReader
func OpenDatabaseReader ¶
func OpenDatabaseReader(filepath string) (*DatabaseReader, error)
func (*DatabaseReader) All ¶
func (db *DatabaseReader) All() ([]Event, error)
func (*DatabaseReader) Close ¶
func (db *DatabaseReader) Close() error
func (*DatabaseReader) Next ¶
func (db *DatabaseReader) Next() (Event, error)
func (*DatabaseReader) Reset ¶
func (db *DatabaseReader) Reset() error
type DatabaseWriter ¶
type DatabaseWriter struct {
// contains filtered or unexported fields
}
func NewDatabaseWriter ¶
func NewDatabaseWriter(writer io.Writer) *DatabaseWriter
func (*DatabaseWriter) Append ¶
func (db *DatabaseWriter) Append(event Event) error
func (*DatabaseWriter) Close ¶
func (db *DatabaseWriter) Close() error
type Event ¶
type Event struct { What EventType When UnixTimestamp // contains filtered or unexported fields }
type EventReader ¶
type EventType ¶
type EventType uint8
ENUM( None = 0 Up = 1 Shutdown = 2 Crash = 3 )
func ParseEventType ¶
ParseEventType attempts to convert a string to a EventType.
func (EventType) MarshalText ¶
MarshalText implements the text marshaller method.
func (*EventType) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
type UnixTimestamp ¶
type UnixTimestamp int64
func (UnixTimestamp) AsTime ¶
func (ut UnixTimestamp) AsTime() time.Time
func (UnixTimestamp) String ¶
func (ut UnixTimestamp) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.