rest_impl

package
v0.0.0-...-1be668c Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// timeout after which new elements are automatically removed
	Timeout time.Duration

	// If set to true, don't serve an api under docs
	DisableSwaggerUI bool

	// Description for the server in openapi.json
	OpenAPIServerDescription string

	// options for the session
	Session SessionOpts
}

Options are the options for a rest server.

func (*Options) SetDefaults

func (opt *Options) SetDefaults()

type Server

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

func NewServer

func NewServer(path string, handler proto.Handler, options Options) *Server

NewServer creates a new rest server implementation.

func (*Server) Close

func (server *Server) Close()

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Session

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

Session holds information about an ongoing process.

func (*Session) CloseInput

func (session *Session) CloseInput() error

CloseInput closes the input of the session.

func (*Session) CloseWith

func (session *Session) CloseWith(err error)

CloseWith cancels the session with the given error.

func (*Session) Init

func (session *Session) Init(handler proto.Handler, ctx context.Context, opt SessionOpts)

Init initializes this session, preparing it for accepting a new session.

func (*Session) Stage

func (session *Session) Stage() (running, started bool)

Stage returns information about the current stage of the session.

Running indicates if the session is currently running its associated process. Started indicates if the session process was started previously.

func (*Session) Start

func (session *Session) Start(r *http.Request, call proto.CallMessage) bool

Start starts the given call in this session.

func (*Session) Status

func (session *Session) Status() Status

Status returns the status.

func (*Session) Wait

func (session *Session) Wait(ctx context.Context) (result any, err error)

Wait waits for this session to complete, and then returns it's result and error. If context closes before the session is completed, immediately returns the context's error.

func (*Session) Write

func (session *Session) Write(data []byte) (int, error)

type SessionOpts

type SessionOpts struct {
	MaxLines int
}

func (*SessionOpts) SetDefaults

func (opt *SessionOpts) SetDefaults()

type Status

type Status struct {
	Buffer string
	Result *proto.Result
}

func (Status) MarshalJSON

func (status Status) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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