server

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerName = "SingleSessionServer"
)

Variables

This section is empty.

Functions

func SingleSessionServerStart

func SingleSessionServerStart(protocol, address string, wrapper *SingleSessionServer) error

Given a server start listening listening synchronously

Types

type PomogoClient

type PomogoClient interface {
	Status() (*pomoStatus, error)
	Pause() (*pomoStatus, error)
	Play() (*pomoStatus, error)
	Skip() (*pomoStatus, error)
	Stop() (*pomoStatus, error)
}

type PomogoSessionServer

type PomogoSessionServer interface {
	Status(
		request struct{},
		reply *pomoController.PomoControllerStatus,
	) error
	Pause(
		request struct{},
		reply *pomoController.PomoControllerStatus,
	) error
	Play(
		request struct{},
		reply *pomoController.PomoControllerStatus,
	) error
	Skip(
		request struct{},
		reply *pomoController.PomoControllerStatus,
	) error
	Stop(
		request struct{},
		reply *pomoController.PomoControllerStatus,
	) error
}

type SClientFuncOpt

type SClientFuncOpt func(*SingleSessionClient) (SClientFuncOpt, error)

func SingleClientRpcHttpConnect

func SingleClientRpcHttpConnect(protocol, address string) SClientFuncOpt

Connect to http-rpc server.

type SServerFuncOpt

type SServerFuncOpt func(*SingleSessionServer) (SServerFuncOpt, error)

func SingleServerContainerOpt

func SingleServerContainerOpt(
	factory func() *pomoController.SingleControllerContainer,
) SServerFuncOpt

Set controller container given a factory function.

func SingleServerRpcRegisterOpt

func SingleServerRpcRegisterOpt(
	protocol, address string,
	serverFactory func() *rpc.Server,
	onListen func(l net.Listener, s *rpc.Server) error,
) SServerFuncOpt

Register the ssServer on an rpc server from server factory (can use rpc.Server directly as factory)

func SingleServerRpcUnixRegOpt

func SingleServerRpcUnixRegOpt(
	address string,
	serverFactory func() *rpc.Server,
	onListen func(l net.Listener, s *rpc.Server) error,
) SServerFuncOpt

Same as before but removes unix socket when done and returns error if socket already exists.

type SessionWrapper

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

func (*SessionWrapper) Pause

func (sw *SessionWrapper) Pause(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SessionWrapper) Play

func (sw *SessionWrapper) Play(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SessionWrapper) Skip

func (sw *SessionWrapper) Skip(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SessionWrapper) Status

func (sw *SessionWrapper) Status(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SessionWrapper) Stop

func (sw *SessionWrapper) Stop(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

type SingleSessionClient

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

Direct wrapper around the client. The lifecycle of the object should not be longer than the connection:

func PomogoRpcClientFactory

func PomogoRpcClientFactory(protocol, address string) (*SingleSessionClient, error)

Initializes rpc client and returns wrapper

func SingleSessionClientFactory

func SingleSessionClientFactory(options ...SClientFuncOpt) (*SingleSessionClient, error)

Create single session rpc client and run it through every option

func (*SingleSessionClient) Pause

func (c *SingleSessionClient) Pause() (*pomoStatus, error)

func (*SingleSessionClient) Play

func (c *SingleSessionClient) Play() (*pomoStatus, error)

func (*SingleSessionClient) Skip

func (c *SingleSessionClient) Skip() (*pomoStatus, error)

func (*SingleSessionClient) Status

func (c *SingleSessionClient) Status() (*pomoStatus, error)

func (*SingleSessionClient) Stop

func (c *SingleSessionClient) Stop() (*pomoStatus, error)

type SingleSessionServer

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

LIFECYCLE MANAGEMENT OF CONTROLLER. It may be better to skip the container step and manage the lifecycle directly from the server object.

func SingleSessionServerFactory

func SingleSessionServerFactory(options ...SServerFuncOpt) (*SingleSessionServer, error)

Creates a new *SingleSessionServer reference and runs it through every option.

func (*SingleSessionServer) Pause

func (c *SingleSessionServer) Pause(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SingleSessionServer) Play

func (c *SingleSessionServer) Play(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

CREATE NEW INSTANCE AND START CONTROLLER COUNTING.

func (*SingleSessionServer) Skip

func (c *SingleSessionServer) Skip(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SingleSessionServer) Status

func (c *SingleSessionServer) Status(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

func (*SingleSessionServer) Stop

func (c *SingleSessionServer) Stop(
	request struct{},
	reply *pomoController.PomoControllerStatus,
) error

Jump to

Keyboard shortcuts

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