Documentation ¶
Index ¶
- Constants
- func CountHeartbeats(filepath string) (int, error)
- func QueueFilepath() (string, error)
- func QueueFilepathLegacy() (string, error)
- func ReadHeartbeats(filepath string, limit int) ([]heartbeat.Heartbeat, error)
- func Sync(filepath string, syncLimit int) func(next heartbeat.Handle) error
- func WithQueue(filepath string) heartbeat.HandleOption
- func WithSync(filepath string, syncLimit int) heartbeat.HandleOption
- type ErrOpenDB
- type Noop
- type Queue
Constants ¶
const ( // PrintMaxDefault is the default maximum number of heartbeats to print. PrintMaxDefault = 10 // SendLimit is the maximum number of heartbeats, which will be sent at once // to the WakaTime API. SendLimit = 25 // SyncMaxDefault is the default maximum number of heartbeats from the // offline queue, which will be synced upon sending heartbeats to the API. SyncMaxDefault = 1000 )
Variables ¶
This section is empty.
Functions ¶
func CountHeartbeats ¶ added in v1.18.1
CountHeartbeats returns the total number of heartbeats in the offline db.
func QueueFilepath ¶
QueueFilepath returns the path for offline queue db file. If the resource directory cannot be detected, it defaults to the current directory.
func QueueFilepathLegacy ¶ added in v1.94.1
QueueFilepathLegacy returns the path for offline queue db file. If the user's $HOME folder cannot be detected, it defaults to the current directory. This is used to support the old db file name and will be removed in the future.
func ReadHeartbeats ¶ added in v1.45.1
ReadHeartbeats reads the informed heartbeats in the offline db.
func WithQueue ¶
func WithQueue(filepath string) heartbeat.HandleOption
WithQueue initializes and returns a heartbeat handle option, which can be used in a heartbeat processing pipeline for automatic handling of failures of heartbeat sending to the API. Upon inability to send due to missing or failing connection to API, failed sending or errors returned by API, the heartbeats will be temporarily stored in a DB and sending will be retried at next usages of the wakatime cli.
Types ¶
type ErrOpenDB ¶ added in v1.73.3
type ErrOpenDB struct {
Err error
}
ErrOpenDB is an error returned when the database cannot be opened.
func (ErrOpenDB) ExitCode ¶ added in v1.73.3
ExitCode method to implement wakaerror.Error interface.
func (ErrOpenDB) SendDiagsOnErrors ¶ added in v1.73.3
SendDiagsOnErrors method to implement wakaerror.SendDiagsOnErrors interface.
func (ErrOpenDB) ShouldLogError ¶ added in v1.73.3
ShouldLogError method to implement wakaerror.ShouldLogError interface.
type Noop ¶ added in v1.44.0
type Noop struct{}
Noop is a noop api client, used by offline.SaveHeartbeats.
type Queue ¶
type Queue struct { Bucket string // contains filtered or unexported fields }
Queue is a db client to temporarily store heartbeats in bolt db, in case heartbeat sending to wakatime api is not possible. Transaction handling is left to the user via the passed in transaction.
func (*Queue) Count ¶ added in v1.18.1
Count returns the total number of heartbeats in the offline db.