-
Notifications
You must be signed in to change notification settings - Fork 4
/
api.go
61 lines (54 loc) · 1.76 KB
/
api.go
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
54
55
56
57
58
59
60
61
package server
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"
)
// Pool manager sets of inner worker processes.
type Pool interface {
// GetConfig returns pool configuration.
GetConfig() *pool.Config
// Workers return a worker list associated with the pool.
Workers() (workers []*worker.Process)
// RemoveWorker removes worker from the pool.
RemoveWorker(ctx context.Context) error
// AddWorker adds worker to the pool.
AddWorker() error
// Exec payload
Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *staticPool.PExec, error)
// Reset kills all workers inside the watcher and replaces with new
Reset(ctx context.Context) error
// Destroy all underlying stacks (but let them complete the task).
Destroy(ctx context.Context)
}
const (
// PluginName for the server
PluginName string = "server"
// RPCPluginName is the name of the RPC plugin, should be in sync with rpc/config.go
RPCPluginName string = "rpc"
// RrRelay env variable key (internal)
RrRelay string = "RR_RELAY"
// RrRPC env variable key (internal) if the RPC presents
RrRPC string = "RR_RPC"
// RrVersion env variable
RrVersion string = "RR_VERSION"
// internal
delim string = "://"
unix string = "unix"
tcp string = "tcp"
pipes string = "pipes"
)
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
// RRVersion is the roadrunner current version
RRVersion() string
}
type NamedLogger interface {
NamedLogger(name string) *zap.Logger
}