http

package
v0.0.0-...-ee0e00b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const CONTENT_TYPE_CBOR = "application/cbor"

Variables

View Source
var (
	ErrInvalidSession  = errors.New("invalid session")
	ErrInvalidResponse = errors.New("invalid http response")
)

Functions

This section is empty.

Types

type Client

type Client[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient[I core.BlockId, R core.BlockIdRef[I]](store core.BlockStore[I], config batch.Config) *Client[I, R]

func (*Client[I, R]) CancelSink

func (c *Client[I, R]) CancelSink(url string) error

CancelSink cancels the sink session with the given URL.

func (*Client[I, R]) CancelSource

func (c *Client[I, R]) CancelSource(url string) error

CancelSource cancels the source session with the given URL.

func (*Client[I, R]) GetSinkSession

func (c *Client[I, R]) GetSinkSession(url string) *core.SinkSession[I, batch.BatchState]

func (*Client[I, R]) GetSourceSession

func (c *Client[I, R]) GetSourceSession(url string) *core.SourceSession[I, batch.BatchState]

func (*Client[I, R]) Receive

func (c *Client[I, R]) Receive(url string, id I) error

TODO: This is only used in test now. Remove?

func (*Client[I, R]) Send

func (c *Client[I, R]) Send(url string, id I) error

TODO: This is only used in test now. Remove?

func (*Client[I, R]) SinkInfo

func (c *Client[I, R]) SinkInfo(url string) (*core.SinkSessionInfo[batch.BatchState], error)

func (*Client[I, R]) SinkSessions

func (c *Client[I, R]) SinkSessions() []string

func (*Client[I, R]) SourceInfo

func (c *Client[I, R]) SourceInfo(url string) (*core.SourceSessionInfo[batch.BatchState], error)

func (*Client[I, R]) SourceSessions

func (c *Client[I, R]) SourceSessions() []string

type Config

type Config struct {
	Address string
}

func DefaultConfig

func DefaultConfig() Config

type HttpClientSinkConnection

type HttpClientSinkConnection[I core.BlockId, R core.BlockIdRef[I]] struct {
	*batch.GenericBatchSinkConnection[I, R]
	// contains filtered or unexported fields
}

func NewHttpClientSinkConnection

func NewHttpClientSinkConnection[I core.BlockId, R core.BlockIdRef[I]](client *http.Client, url string, stats stats.Stats, instrument instrumented.InstrumentationOptions, maxBlocksPerRound uint32) *HttpClientSinkConnection[I, R]

func (*HttpClientSinkConnection[I, R]) ImmediateSender

func (conn *HttpClientSinkConnection[I, R]) ImmediateSender(session *core.SinkSession[I, batch.BatchState]) core.StatusSender[I]

type HttpClientSourceConnection

type HttpClientSourceConnection[I core.BlockId, R core.BlockIdRef[I]] struct {
	*batch.GenericBatchSourceConnection[I, R]
	// contains filtered or unexported fields
}

func NewHttpClientSourceConnection

func NewHttpClientSourceConnection[I core.BlockId, R core.BlockIdRef[I]](client *http.Client, url string, stats stats.Stats, instrument instrumented.InstrumentationOptions, maxBlocksPerRound uint32, maxBlocksPerColdCall uint32) *HttpClientSourceConnection[I, R]

func (*HttpClientSourceConnection[I, R]) ImmediateSender

func (conn *HttpClientSourceConnection[I, R]) ImmediateSender(session *core.SourceSession[I, batch.BatchState], maxBlocksPerRound uint32) core.BlockSender[I]

type RequestBatchBlockSender

type RequestBatchBlockSender[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func (*RequestBatchBlockSender[I, R]) Close

func (bbs *RequestBatchBlockSender[I, R]) Close() error

func (*RequestBatchBlockSender[I, R]) SendList

func (bbs *RequestBatchBlockSender[I, R]) SendList(blocks []core.RawBlock[I]) error

type RequestStatusSender

type RequestStatusSender[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func (*RequestStatusSender[I, R]) Close

func (ss *RequestStatusSender[I, R]) Close() error

func (*RequestStatusSender[I, R]) SendStatus

func (ss *RequestStatusSender[I, R]) SendStatus(have filter.Filter[I], want []I) error

type ResponseBatchBlockSender

type ResponseBatchBlockSender[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func (*ResponseBatchBlockSender[I, R]) Close

func (bbs *ResponseBatchBlockSender[I, R]) Close() error

func (*ResponseBatchBlockSender[I, R]) SendList

func (bbs *ResponseBatchBlockSender[I, R]) SendList(blocks []core.RawBlock[I]) error

type ResponseStatusSender

type ResponseStatusSender[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func (*ResponseStatusSender[I, R]) Close

func (ss *ResponseStatusSender[I, R]) Close() error

func (*ResponseStatusSender[I, R]) SendStatus

func (ss *ResponseStatusSender[I, R]) SendStatus(have filter.Filter[I], want []I) error

type Server

type Server[I core.BlockId, R core.BlockIdRef[I]] struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer[I core.BlockId, R core.BlockIdRef[I]](store core.BlockStore[I], serverConfig Config, responderConfig batch.Config) *Server[I, R]

TODO: change config to something more flexible, so it can work for responder and this server. We have server config and responder config, and they are different. Start with 2 configs I guess

func (*Server[I, R]) HandleBlocks

func (srv *Server[I, R]) HandleBlocks(response http.ResponseWriter, request *http.Request)

func (*Server[I, R]) HandleStatus

func (srv *Server[I, R]) HandleStatus(response http.ResponseWriter, request *http.Request)

func (*Server[I, R]) SinkInfo

func (srv *Server[I, R]) SinkInfo(token batch.SessionId) (*core.SinkSessionInfo[batch.BatchState], error)

func (*Server[I, R]) SinkSessions

func (srv *Server[I, R]) SinkSessions() []batch.SessionId

func (*Server[I, R]) SourceInfo

func (srv *Server[I, R]) SourceInfo(token batch.SessionId) (*core.SourceSessionInfo[batch.BatchState], error)

func (*Server[I, R]) SourceSessions

func (srv *Server[I, R]) SourceSessions() []batch.SessionId

func (*Server[I, R]) Start

func (srv *Server[I, R]) Start() error

Start starts the server

func (*Server[I, R]) Stop

func (srv *Server[I, R]) Stop() error

Stop stops the server

Jump to

Keyboard shortcuts

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