gs

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ModeDefault    = Mode("default")
	ModeOnlyParser = Mode("only-parser")
	ModeOnlySender = Mode("only-sender")
)

Functions

func RegisterServers added in v0.5.0

func RegisterServers(servers []string)

Types

type BothWorker added in v0.3.0

type BothWorker struct {
	Client       *Client
	SenderWorker *SenderWorker
	ParserWorker *ParserWorker
	// contains filtered or unexported fields
}

func NewBothWorker added in v0.3.0

func NewBothWorker(client *Client, tag string, sender func(chan<- *api.Task), parser func(*api.Raw, *Client) error, options ...WorkerOptions) *BothWorker

func (*BothWorker) GetName added in v0.4.0

func (w *BothWorker) GetName() string

func (*BothWorker) Run added in v0.3.0

func (w *BothWorker) Run(ctx context.Context)

func (*BothWorker) SetConfig added in v0.5.3

func (w *BothWorker) SetConfig(cfg *WorkerConfig)

type Client added in v0.3.1

type Client struct {
	api.GazerSystemClient
}

func NewClient

func NewClient(server string) *Client

func NewClientWithLB added in v0.5.0

func NewClientWithLB(servers ...string) *Client

func (*Client) SendOneTask added in v0.3.1

func (c *Client) SendOneTask(task *api.Task) error

func (*Client) SendTasks added in v0.3.1

func (c *Client) SendTasks(tasks []*api.Task) error

type GazerSystemResolver added in v0.5.0

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

GazerSystemResolver Resolver(https://godoc.org/google.golang.org/grpc/resolver#Resolver).

func (*GazerSystemResolver) Close added in v0.5.0

func (*GazerSystemResolver) Close()

func (*GazerSystemResolver) ResolveNow added in v0.5.0

type GazerSystemResolverBuilder added in v0.5.0

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

GazerSystemResolverBuilder ResolverBuilder(https://godoc.org/google.golang.org/grpc/resolver#Builder).

func (*GazerSystemResolverBuilder) Build added in v0.5.0

func (*GazerSystemResolverBuilder) Scheme added in v0.5.0

type Mode added in v0.6.0

type Mode string

type ParserUnit added in v0.2.0

type ParserUnit interface {
	WorkUnit
	Parser(raw *api.Raw, client Client) error
	GetTargetURL() *url.URL
}

type ParserWorker added in v0.2.0

type ParserWorker struct {
	Client *Client
	Tag    string

	Parser func(*api.Raw, *Client) error
	// contains filtered or unexported fields
}

func NewParserWorker added in v0.2.0

func NewParserWorker(gazerSystemClient *Client, tag string, parser func(*api.Raw, *Client) error, options ...WorkerOptions) *ParserWorker

func (*ParserWorker) GetName added in v0.4.0

func (p *ParserWorker) GetName() string

func (*ParserWorker) Run added in v0.2.0

func (p *ParserWorker) Run(ctx context.Context)

func (*ParserWorker) SetConfig added in v0.5.4

func (p *ParserWorker) SetConfig(cfg *WorkerConfig)

type SenderUnit added in v0.2.0

type SenderUnit interface {
	WorkUnit
	Sender(chan<- string)
}

type SenderWorker added in v0.2.0

type SenderWorker struct {
	Client      *Client
	TaskChannel chan *api.Task
	Sender      func(chan<- *api.Task)
	// contains filtered or unexported fields
}

func NewSenderWorker added in v0.2.0

func NewSenderWorker(client *Client, name string, sender func(chan<- *api.Task), options ...WorkerOptions) *SenderWorker

func (*SenderWorker) GetName added in v0.4.0

func (s *SenderWorker) GetName() string

func (*SenderWorker) Run added in v0.2.0

func (s *SenderWorker) Run(ctx context.Context)

func (*SenderWorker) SetConfig added in v0.5.4

func (s *SenderWorker) SetConfig(cfg *WorkerConfig)

type WorkUnit added in v0.2.0

type WorkUnit interface {
	Run(ctx context.Context)
	GetName() string
	SetConfig(cfg *WorkerConfig)
}

type Worker added in v0.2.0

type Worker interface {
	Run(ctx context.Context)
}

type WorkerConfig added in v0.5.3

type WorkerConfig struct {
	Debug             bool
	SpeedometerServer string
	Mode              Mode
}

type WorkerGroup added in v0.2.0

type WorkerGroup struct {
	WorkerList []WorkUnit
	Server     string
	Client     *Client
	// contains filtered or unexported fields
}

func NewWorkerGroup added in v0.2.0

func NewWorkerGroup(servers []string, options ...WorkerOptions) *WorkerGroup

func (*WorkerGroup) AddByWorkUnit added in v0.2.0

func (g *WorkerGroup) AddByWorkUnit(w WorkUnit)

func (*WorkerGroup) AddWorker added in v0.2.0

func (g *WorkerGroup) AddWorker(targetURL string, sender func(chan<- *api.Task), parser func(*api.Raw, *Client) error, options ...WorkerOptions)

func (*WorkerGroup) Run added in v0.2.0

func (g *WorkerGroup) Run(ctx context.Context)

type WorkerOptions added in v0.5.3

type WorkerOptions func(*WorkerConfig)

func WithDebug added in v0.5.3

func WithDebug(debug bool) WorkerOptions

func WithMode added in v0.6.0

func WithMode(mode Mode) WorkerOptions

func WithSpeedometerServer added in v0.5.3

func WithSpeedometerServer(server string) WorkerOptions

Jump to

Keyboard shortcuts

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