-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathinterfaces.go
More file actions
53 lines (46 loc) · 1.62 KB
/
Copy pathinterfaces.go
File metadata and controls
53 lines (46 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Package api defines public interfaces for the gRPC plugin components.
package api
import (
"context"
"github.com/roadrunner-server/pool/payload"
"github.com/roadrunner-server/pool/pool"
staticPool "github.com/roadrunner-server/pool/pool/static_pool"
"github.com/roadrunner-server/pool/worker"
"go.uber.org/zap"
"google.golang.org/grpc"
)
type Interceptor interface {
UnaryServerInterceptor() grpc.UnaryServerInterceptor
Name() string
}
type Configurer interface {
// UnmarshalKey takes a single key and unmarshal it into a Struct.
UnmarshalKey(name string, out any) error
// Has checks if a config section exists.
Has(name string) bool
// Experimental returns true if experimental mode is enabled.
Experimental() bool
}
type Pool interface {
// Workers return a worker list associated with the pool.
Workers() (workers []*worker.Process)
// Exec payload
Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *staticPool.PExec, error)
// RemoveWorker removes worker from the pool.
RemoveWorker(ctx context.Context) error
// AddWorker adds worker to the pool.
AddWorker() error
// Reset kill all workers inside the watcher and replaces with new
Reset(ctx context.Context) error
// Destroy the underlying stack (but let them complete the task).
Destroy(ctx context.Context)
// QueueSize shows the number of requests in the queue
QueueSize() uint64
}
type Logger interface {
NamedLogger(name string) *zap.Logger
}
// Server creates workers for the application.
type Server interface {
NewPool(ctx context.Context, cfg *pool.Config, env map[string]string, _ *zap.Logger) (*staticPool.Pool, error)
}