iocb

package
v0.0.0-...-f95323f Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IOCB

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

func NewIOCB

func NewIOCB(localLog zerolog.Logger, request PDU, destination *Address) (*IOCB, error)

func (*IOCB) Abort

func (i *IOCB) Abort(err error) error

Abort Called by a client to abort a transaction.

func (*IOCB) AddCallback

func (i *IOCB) AddCallback(fn func())

AddCallback Pass a function to be called when IO is complete.

func (*IOCB) Close

func (i *IOCB) Close() error

func (*IOCB) Complete

func (i *IOCB) Complete(apdu PDU) error

Complete Called to complete a transaction, usually when ProcessIO has shipped the IOCB off to some other thread or

function.

func (*IOCB) GetDestination

func (i *IOCB) GetDestination() *Address

func (*IOCB) GetIOError

func (i *IOCB) GetIOError() error

func (*IOCB) GetIOResponse

func (i *IOCB) GetIOResponse() PDU

func (*IOCB) Serialize

func (d *IOCB) Serialize() ([]byte, error)

func (*IOCB) SerializeWithWriteBuffer

func (d *IOCB) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IOCB) SetTimeout

func (i *IOCB) SetTimeout(delay time.Duration)

SetTimeout Called to set a transaction timer.

func (*IOCB) String

func (d *IOCB) String() string

func (*IOCB) Trigger

func (i *IOCB) Trigger()

Trigger Set the completion event and make the callback(s)

func (*IOCB) Wait

func (i *IOCB) Wait()

Wait for the completion event to be set

type IOCBContract

type IOCBContract interface {
	fmt.Stringer

	Trigger()

	GetDestination() *Address

	Abort(err error) error
	// contains filtered or unexported methods
}

IOCBContract provides a set of functions which can be overwritten by a sub struct

type IOCBState

type IOCBState int
const (
	IOCBState_IDLE IOCBState = iota
	IOCBState_PENDING
	IOCBState_ACTIVE
	IOCBState_COMPLETED
	IOCBState_ABORTED
)

func (IOCBState) String

func (i IOCBState) String() string

type IOController

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

func NewIOController

func NewIOController(localLog zerolog.Logger, name string, requirements IOControllerRequirements, options ...Option) (*IOController, error)

func (*IOController) Abort

func (i *IOController) Abort(err error) error

Abort all requests, no default implementation.

func (*IOController) AbortIO

func (i *IOController) AbortIO(iocb IOCBContract, err error) error

AbortIO Called by a handler or a client to abort a transaction

func (*IOController) ActiveIO

func (i *IOController) ActiveIO(iocb IOCBContract) error

ActiveIO Called by a handler to notify the controller that a request is being processed

func (*IOController) CompleteIO

func (i *IOController) CompleteIO(iocb IOCBContract, apdu PDU) error

CompleteIO Called by a handler to return data to the client

func (*IOController) ProcessIO

func (i *IOController) ProcessIO(IOCBContract) error

ProcessIO Figure out how to respond to this request. This must be provided by the derived class.

func (*IOController) RequestIO

func (i *IOController) RequestIO(iocb IOCBContract) error

RequestIO Called by a client to start processing a request.

func (*IOController) Serialize

func (d *IOController) Serialize() ([]byte, error)

func (*IOController) SerializeWithWriteBuffer

func (d *IOController) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IOController) String

func (d *IOController) String() string

type IOControllerRequirements

type IOControllerRequirements interface {
	Abort(err error) error
	ProcessIO(iocb IOCBContract) error
	CompleteIO(iocb IOCBContract, pdu PDU) error
	AbortIO(iocb IOCBContract, err error) error
}

type IOQController

type IOQController struct {
	*IOController `stringer:"true"`

	ActiveIOCB IOCBContract `stringer:"true"`
	IoQueue    *IOQueue     `stringer:"true"`
	// contains filtered or unexported fields
}

func NewIOQController

func NewIOQController(localLog zerolog.Logger, name string, requirements IOQControllerRequirements) (*IOQController, error)

func (*IOQController) Abort

func (i *IOQController) Abort(err error) error

Abort all pending requests

func (*IOQController) AbortIO

func (i *IOQController) AbortIO(iocb IOCBContract, err error) error

AbortIO Called by a handler or a client to abort a transaction

func (*IOQController) ActiveIO

func (i *IOQController) ActiveIO(iocb IOCBContract) error

ActiveIO Called by a handler to notify the controller that a request is being processed

func (*IOQController) Close

func (i *IOQController) Close() error

func (*IOQController) CompleteIO

func (i *IOQController) CompleteIO(iocb IOCBContract, msg PDU) error

CompleteIO Called by a handler to return data to the client

func (*IOQController) ProcessIO

func (i *IOQController) ProcessIO(IOCBContract) error

ProcessIO Figure out how to respond to this request. This must be provided by the derived class

func (*IOQController) RequestIO

func (i *IOQController) RequestIO(iocb IOCBContract) error

RequestIO Called by a client to start processing a request

func (*IOQController) Serialize

func (d *IOQController) Serialize() ([]byte, error)

func (*IOQController) SerializeWithWriteBuffer

func (d *IOQController) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IOQController) String

func (d *IOQController) String() string

type IOQControllerRequirements

type IOQControllerRequirements interface {
	IOControllerRequirements
	ProcessIO(iocb IOCBContract) error
}

type IOQControllerStates

type IOQControllerStates int
const (
	IOQControllerStates_CTRL_IDLE IOQControllerStates = iota
	IOQControllerStates_CTRL_ACTIVE
	IOQControllerStates_CTRL_WAITING
)

func (IOQControllerStates) String

func (i IOQControllerStates) String() string

type IOQueue

type IOQueue struct {
	Queue PriorityQueue[int, IOCBContract]
	// contains filtered or unexported fields
}

func NewIOQueue

func NewIOQueue(localLog zerolog.Logger, name string) *IOQueue

func (*IOQueue) Abort

func (i *IOQueue) Abort(err error)

Abort all the control blocks in the queue

func (*IOQueue) Close

func (i *IOQueue) Close() error

func (*IOQueue) Get

func (i *IOQueue) Get(block bool, delay *time.Duration) (IOCBContract, error)

Get a request from a queue, optionally block until a request is available.

func (*IOQueue) Put

func (i *IOQueue) Put(iocb IOCBContract) error

Put an IOCB to a queue. This is usually called by the function that filters requests and passes them out to the

correct processing thread.

func (*IOQueue) Remove

func (i *IOQueue) Remove(iocb IOCBContract) error

Remove a control block from the queue, called if the request

is canceled/aborted

func (*IOQueue) Serialize

func (d *IOQueue) Serialize() ([]byte, error)

func (*IOQueue) SerializeWithWriteBuffer

func (d *IOQueue) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IOQueue) String

func (d *IOQueue) String() string

type SieveQueue

type SieveQueue struct {
	*IOQController
	// contains filtered or unexported fields
}

func NewSieveQueue

func NewSieveQueue(localLog zerolog.Logger, fn func(apdu PDU), address *Address) (*SieveQueue, error)

func (*SieveQueue) ProcessIO

func (s *SieveQueue) ProcessIO(iocb IOCBContract) error

func (*SieveQueue) Serialize

func (d *SieveQueue) Serialize() ([]byte, error)

func (*SieveQueue) SerializeWithWriteBuffer

func (d *SieveQueue) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*SieveQueue) String

func (d *SieveQueue) String() string

Jump to

Keyboard shortcuts

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