api

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeoutHeaderName     = "X-Styx-Timeout"
	RecordLinesMediaType  = "application/vnd.styx.line-delimited"
	RecordBinaryMediaType = "application/vnd.styx.binary-records"
	StyxProtocolString    = "styx/0"
)

Variables

View Source
var (
	ErrUnknownError         = NewError(defaultErrorCode, defaultErrorMessage)
	ErrMethodNotAllowed     = NewError(methodNotAllowedErrorCode, methodNotAllowedErrorMessage)
	ErrNotFound             = NewError(notFoundErrorCode, notFoundErrorMessage)
	ErrLogExist             = NewError(logExistErrorCode, logExistErrorMessage)
	ErrLogNotFound          = NewError(logNotFoundErrorCode, logNotFoundErrorMessage)
	ErrLogNotAvailable      = NewError(logNotAvailableErrorCode, logNotAvailableErrorMessage)
	ErrLogInvalidName       = NewError(logInvalidNameCode, logInvalidNameMessage)
	ErrMissingContentLength = NewError(missingLengthErrorCode, missingLengthErrorMessage)
)
View Source
var (
	ErrInvalidWhence = errors.New("invalid whence")
)

Functions

func MarshalJson

func MarshalJson(v interface{}) (bytes []byte, err error)

func ReadError

func ReadError(r io.Reader) (err error)

func ReadResponse

func ReadResponse(r io.Reader, v interface{})

func WriteError

func WriteError(w http.ResponseWriter, statusCode int, v interface{})

func WriteResponse

func WriteResponse(w http.ResponseWriter, statusCode int, v interface{})

Types

type CreateLogForm

type CreateLogForm struct {
	Name string `schema:"name,required"`
	*LogConfig
}

type CreateLogResponse

type CreateLogResponse LogInfo

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

func NewError

func NewError(code string, message string) (e *Error)

func (*Error) Error

func (e *Error) Error() (m string)

type GetLogResponse

type GetLogResponse LogInfo

type ListLogsResponse

type ListLogsResponse []LogInfo

type LogConfig

type LogConfig struct {
	MaxRecordSize   int   `schema:"max_record_size"`
	IndexAfterSize  int64 `schema:"index_after_size"`
	SegmentMaxCount int64 `schema:"segment_max_count"`
	SegmentMaxSize  int64 `schema:"segment_max_size"`
	SegmentMaxAge   int64 `schema:"segment_max_age"`
	LogMaxCount     int64 `schema:"log_max_count"`
	LogMaxSize      int64 `schema:"log_max_size"`
	LogMaxAge       int64 `schema:"log_max_age"`
}

type LogInfo

type LogInfo struct {
	Name          string           `json:"name"`
	Status        logman.LogStatus `json:"status"`
	RecordCount   int64            `json:"record_count"`
	FileSize      int64            `json:"file_size"`
	StartPosition int64            `json:"start_position"`
	EndPosition   int64            `json:"end_position"`
}

type ParamsError

type ParamsError Error

func NewParamsError

func NewParamsError(err error) (e *ParamsError)

func (*ParamsError) Error

func (e *ParamsError) Error() (m string)

type ReadRecordParams

type ReadRecordParams struct {
	Whence   log.Whence `schema:"whence"`
	Position int64      `schema:"position"`
}

func (ReadRecordParams) Validate

func (p ReadRecordParams) Validate() (err error)

type ReadRecordsBatchParams

type ReadRecordsBatchParams struct {
	Whence   log.Whence `schema:"whence"`
	Position int64      `schema:"position"`
	Count    int64      `schema:"count"`
	Follow   bool       `schema:"follow"`
}

func (ReadRecordsBatchParams) Validate

func (p ReadRecordsBatchParams) Validate() (err error)

type ReadRecordsLinesParams

type ReadRecordsLinesParams ReadRecordsBatchParams

func (ReadRecordsLinesParams) Validate

func (p ReadRecordsLinesParams) Validate() (err error)

type ReadRecordsTCPParams

type ReadRecordsTCPParams struct {
	Whence   log.Whence `schema:"whence"`
	Position int64      `schema:"position"`
	Count    int64      `schema:"count"`
	Follow   bool       `schema:"follow"`
}

func (ReadRecordsTCPParams) Validate

func (p ReadRecordsTCPParams) Validate() (err error)

type ReadRecordsWSParams

type ReadRecordsWSParams ReadRecordsTCPParams

func (ReadRecordsWSParams) Validate

func (p ReadRecordsWSParams) Validate() (err error)

type RestoreLogParams

type RestoreLogParams struct {
	Name string `schema:"name,required"`
}

type WriteRecordResponse

type WriteRecordResponse struct {
	Position int64 `json:"position"`
	Count    int64 `json:"count"`
}

type WriteRecordsBatchResponse

type WriteRecordsBatchResponse WriteRecordResponse

type WriteRecordsLinesResponse

type WriteRecordsLinesResponse WriteRecordResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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