-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathengine_linux.go
More file actions
31 lines (27 loc) · 847 Bytes
/
Copy pathengine_linux.go
File metadata and controls
31 lines (27 loc) · 847 Bytes
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
//go:build linux
package celeris
import (
"fmt"
"github.com/goceleris/celeris/adaptive"
"github.com/goceleris/celeris/engine"
"github.com/goceleris/celeris/engine/epoll"
"github.com/goceleris/celeris/engine/iouring"
"github.com/goceleris/celeris/engine/std"
"github.com/goceleris/celeris/internal/cpumon"
"github.com/goceleris/celeris/protocol/h2/stream"
"github.com/goceleris/celeris/resource"
)
func createEngine(cfg resource.Config, handler stream.Handler, cpuMon cpumon.Monitor) (engine.Engine, error) {
switch cfg.Engine {
case engine.IOUring:
return iouring.New(cfg, handler)
case engine.Epoll:
return epoll.New(cfg, handler)
case engine.Adaptive:
return adaptive.New(cfg, handler, cpuMon)
case engine.Std:
return std.New(cfg, handler)
default:
return nil, fmt.Errorf("unknown engine type: %v", cfg.Engine)
}
}