watched

package module
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2021 License: GPL-3.0 Imports: 6 Imported by: 4

README

Watch Elite: Dangerous Journal Files

This is a Go library to watch Journal files of Elite: Dangerous. The commander's Journal is official way to hook player tools into E:D.

This root package only defines some abstractions for event processing. This gives developers the opportunity to build different processing strategies for the events coming from ED.

Building

Using watched as a library does not need anything special. Just

import "github.com/CmdrVasquess/watched"

in your application.

If you want to build edeh and use it right in place, you have to build the project. Want to get platform independent, instead of make try to use

$ go run mk/mk.go

Documentation

Index

Constants

View Source
const (
	StatCargoName    = "Cargo"
	StatMarketName   = "Market"
	StatModulesName  = "ModuleInfo"
	StatNavRouteName = "NavRoute"
	StatOutfitName   = "Outfitting"
	StatShipyardName = "Shipyard"
	StatStatusName   = "Status"
)
View Source
const Stop = internal.StopEvent(0)

Variables

This section is empty.

Functions

func LogCfg

func LogCfg() c4hgol.Configurer

func Peek added in v0.6.0

func Peek(str []byte) (t time.Time, event string, err error)

func PeekEvent added in v0.6.0

func PeekEvent(str []byte) (event string, err error)

func PeekTime added in v0.6.0

func PeekTime(str []byte) (t time.Time, err error)

Types

type BranchConfig added in v0.6.0

type BranchConfig struct {
	JournalQLen int
	StatusQLen  int
}

type EventRecv added in v0.6.0

type EventRecv interface {
	OnJournalEvent(e JounalEvent) error
	OnStatusEvent(e StatusEvent) error
	Close() error
}

type EventSrc added in v0.6.0

type EventSrc struct {
	Journal <-chan JounalEvent
	Status  <-chan StatusEvent
}

type JEIDCounter added in v0.6.7

type JEIDCounter struct {
	// contains filtered or unexported fields
}

func (*JEIDCounter) Count added in v0.6.7

func (idc *JEIDCounter) Count(t time.Time) (JEventID, error)

func (*JEIDCounter) CountUnix added in v0.6.7

func (idc *JEIDCounter) CountUnix(tu int64) (JEventID, error)

func (*JEIDCounter) Last added in v0.6.7

func (idc *JEIDCounter) Last() JEventID

func (*JEIDCounter) SetLast added in v0.6.7

func (idc *JEIDCounter) SetLast(jeid JEventID)

type JEventID added in v0.6.0

type JEventID = int64
const StartNow JEventID = -1

type JounalEvent added in v0.6.0

type JounalEvent struct {
	Serial JEventID
	Event  RawEvent
}

type RawEvent added in v0.6.0

type RawEvent []byte

func (RawEvent) Peek added in v0.6.0

func (re RawEvent) Peek() (time.Time, string, error)

func (RawEvent) PeekEvent added in v0.6.0

func (re RawEvent) PeekEvent() (string, error)

func (RawEvent) PeekTime added in v0.6.0

func (re RawEvent) PeekTime() (time.Time, error)

type RecvToSrc added in v0.6.0

type RecvToSrc struct {
	// contains filtered or unexported fields
}

func (*RecvToSrc) Branch added in v0.6.0

func (rs *RecvToSrc) Branch(cfg BranchConfig) EventSrc

func (*RecvToSrc) Close added in v0.6.0

func (rs *RecvToSrc) Close() error

func (*RecvToSrc) OnJournalEvent added in v0.6.4

func (rs *RecvToSrc) OnJournalEvent(e JounalEvent) error

func (*RecvToSrc) OnStatusEvent added in v0.6.4

func (rs *RecvToSrc) OnStatusEvent(e StatusEvent) error

type StatusEvent added in v0.6.0

type StatusEvent struct {
	Type  StatusType
	Event RawEvent
}

type StatusType added in v0.6.0

type StatusType int
const (
	StatCargo StatusType = iota + 1
	StatMarket
	StatModules
	StatNavRoute
	StatOutfit
	StatShipyard
	StatStatus
)

func ParseStatusType added in v0.6.0

func ParseStatusType(s string) StatusType

func (StatusType) String added in v0.6.0

func (st StatusType) String() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL