2025-01-04 23:27:46 +01:00
|
|
|
package request
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"git.defalsify.org/vise.git/resource"
|
|
|
|
"git.defalsify.org/vise.git/persist"
|
|
|
|
"git.defalsify.org/vise.git/engine"
|
|
|
|
"git.defalsify.org/vise.git/logging"
|
2025-01-10 11:53:27 +01:00
|
|
|
"git.grassecon.net/grassrootseconomics/visedriver/storage"
|
2025-01-04 23:27:46 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
logg = logging.NewVanilla().WithDomain("visedriver.request")
|
|
|
|
)
|
|
|
|
|
|
|
|
type RequestSession struct {
|
|
|
|
Ctx context.Context
|
|
|
|
Config engine.Config
|
|
|
|
Engine engine.Engine
|
|
|
|
Input []byte
|
|
|
|
Storage *storage.Storage
|
|
|
|
Writer io.Writer
|
|
|
|
Continue bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: seems like can remove this.
|
|
|
|
type RequestParser interface {
|
2025-01-19 10:35:09 +01:00
|
|
|
GetSessionId(context.Context, any) (string, error)
|
|
|
|
GetInput(any) ([]byte, error)
|
2025-01-04 23:27:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type RequestHandler interface {
|
|
|
|
GetConfig() engine.Config
|
|
|
|
GetRequestParser() RequestParser
|
2025-01-19 10:35:09 +01:00
|
|
|
GetEngine(engine.Config, resource.Resource, *persist.Persister) engine.Engine
|
|
|
|
Process(RequestSession) (RequestSession, error)
|
|
|
|
Output(RequestSession) (RequestSession, error)
|
|
|
|
Reset(context.Context, RequestSession) (RequestSession, error)
|
|
|
|
Shutdown(ctx context.Context)
|
2025-01-04 23:27:46 +01:00
|
|
|
}
|