types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource

type DataSource interface {
	Fetch() (Req, error)
}

type FlowControl

type FlowControl interface {
	Wait(n uint32) (ok bool) // Ждем разрешения на отправку пакета длиной n. Если ok == false, стрим больше не может отправлять данные
	Disable()                // Переводит flow control в невалидное состояние
	Add(n uint32)            // Увеличение размера окна на отправку
	Reset(n uint32)          // Сбрасывает состояние
}

type Frame

type Frame struct {
	Chunks           [3][]byte
	FlowControlPrice uint32
}

type HPackFieldWriter

type HPackFieldWriter interface {
	SetWriter(w io.Writer)
	WriteField(k, v string)
}

type LoaderReporter

type LoaderReporter interface {
	Acquire(tag string, streamID uint32) StreamState
}

type Releaser

type Releaser interface {
	Release()
}

type Reporter

type Reporter interface {
	LoaderReporter
	Run() error
	Close() error
}

type Req

type Req interface {
	SetUp(
		maxFramePayloadLen int,
		maxHeaderListSize int,
		streamID uint32,
		fieldWriter HPackFieldWriter,
	) ([]Frame, error)
	FullMethodName() string
	Tag() string
	Size() int
	Releaser
}

type Stream

type Stream interface {
	ID() uint32
	FC() FlowControl
	StreamState
}

type StreamState

type StreamState interface {
	RequestError(error)                          // не смогли подготовить запрос: не смогли декодировать запрос, привысили лимиты сервера (SettingMaxHeaderListSize) etc
	FirstByteSent()                              // отправили первый байт
	LastByteSent()                               // отправили последний байт
	SetSize(int)                                 // сообщаем какой размер у данного унарного стрима
	OnHeader(name, value string)                 // сообщаем хедеры по мере их получения
	IoError(error)                               // сообщаем стриму, что получили ошибку ввода/вывода
	RSTStream(code http2.ErrCode)                // если получили RST_STREAM
	GoAway(code http2.ErrCode, debugData []byte) // получен фрейм goaway со stream id > текущего
	Timeout()                                    // случился таймаут стрима
	End()                                        // завершение стрима. отправляет результат в отчет
}

type StreamStore

type StreamStore interface {
	Set(uint32, Stream)         // добавить стрим в хранилище
	Get(uint32) Stream          // получить стрим из хранилища
	GetAndDelete(uint32) Stream // удалить и вернуть
	Delete(uint32)              // удалить стрим из хранилища
	Each(func(Stream))          // итерируется по всем стримам хранилища
}

type Streams added in v0.1.2

type Streams struct {
	Pool    StreamsPool
	Limiter StreamsLimiter
	Store   StreamStore
}

type StreamsLimiter added in v0.1.2

type StreamsLimiter interface {
	WaitAllow() // дождаться разрешение лимитера на создание нового стрима
	Release()   // сообщить о завершении стрима
}

type StreamsPool added in v0.1.2

type StreamsPool interface {
	Acquire(streamID uint32, tag string) Stream
}

Jump to

Keyboard shortcuts

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