routes

package
v0.0.0-...-3db37ce Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RESERVEDKEYSPREFIXES = []string{
	"topic.",
	"topic.settings.",
	"auth.",
	"auth.username.",
	"auth.token.",
}

Reserved words and keys

Functions

func GenerateAdminMiddleWare

func GenerateAdminMiddleWare(gpqs RouteHandler) echo.MiddlewareFunc

generateAdminMiddleWare generates a middleware function that checks for a valid token

func GenerateAuthMiddleWare

func GenerateAuthMiddleWare(gpqs RouteHandler) echo.MiddlewareFunc

generateAuthMiddleWare generates a middleware function that checks for a valid token

func Prioritize

func Prioritize(topicName string, gpqs *RouteHandler)

Prioritize reprioritizes the GPQ at the specified rate It also can dynamically update its own settings

Types

type RouteHandler

type RouteHandler struct {
	WS             *echo.Echo
	Topics         *hashmap.Map[string, *gpq.GPQ[[]byte]]
	TopicsSettings *hashmap.Map[string, *schema.Topic]
	Users          *hashmap.Map[string, *schema.User]
	ValidTokens    *hashmap.Map[string, schema.Token]
	SettingsDB     *badger.DB
	Logger         *zap.SugaredLogger
	WaitForSync    *sync.WaitGroup
}

func (*RouteHandler) AddTopic

func (rt *RouteHandler) AddTopic(c echo.Context) error

@Summary Add Topic @Description Adds a topic to the gpq server @Tags Topics @ID add-topic @Accept json @Produce json @Param name query string true "Topic Name" @Param disk_path query string true "Disk Path" @Param buckets query int true "Buckets" @Param sync_to_disk query bool true "Sync To Disk" @Param reprioritize query bool true "Reprioritize" @Param reprioritize_rate query string true "Reprioritize Rate" @Param batch_size query int64 true "Batch Size" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /management/topic/add [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) AddUser

func (rt RouteHandler) AddUser(c echo.Context) error

@Summary Add User @Description Adds a user to the database @Tags Users @ID users-add @Accept json @Produce json @Param credentials body schema.Credentials true "User Credentials" @Success 200 {string} string "User added" @Failure 400 {string} string "Bad Request" @Failure 500 {string} string "Internal Server Error" @Router /settings/user/add [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) ArrowReceive

func (rt RouteHandler) ArrowReceive(c echo.Context) error

@Summary Receive Arrow Data @Description Receives Arrow data and enqueues it into a topic @Tags Arrow @ID arrow-receive @Accept application/vnd.apache.arrow @Produce json @Param name path string true "Topic Name" @Param priority query int true "Priority" @Param should_escalate query bool true "Should Escalate" @Param escalate_every query string true "Escalate Every" @Param can_timeout query bool true "Can Timeout" @Param timeout_duration query string true "Timeout Duration" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/arrow/enqueue [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) ArrowServe

func (rt RouteHandler) ArrowServe(c echo.Context) error

@Summary Serve Arrow Data @Description Batches and serves Arrow data from a topic @Tags Arrow @ID arrow-serve @Produce application/vnd.apache.arrow.stream @Param name path string true "Topic Name" @Param records query int false "Number of records to collect" @Success 200 {array} byte "Arrow Data" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/arrow/dequeue [get] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (*RouteHandler) Auth

func (rt *RouteHandler) Auth(c echo.Context) error

@Summary Authenticate @Description Authenticates a user and returns a token @Tags Auth @ID auth @Accept json @Produce json @Param credentials body schema.Credentials true "Credentials" @Success 200 {object} schema.Token "OK" @Failure 400 {string} string "Bad Request" @Router /auth [post]

func (RouteHandler) AvroReceive

func (rt RouteHandler) AvroReceive(c echo.Context) error

@Summary Receive Avro Data @Description Receives Avro data and enqueues it into a topic @Tags Avro @ID avro-receive @Accept application/vnd.apache.avro @Produce json @Param name path string true "Topic Name" @Param priority query int true "Priority" @Param should_escalate query bool true "Should Escalate" @Param escalate_every query string true "Escalate Every" @Param can_timeout query bool true "Can Timeout" @Param timeout_duration query string true "Timeout Duration" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/avro/enqueue [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) AvroServe

func (rt RouteHandler) AvroServe(c echo.Context) error

@Summary Serve Avro Data @Description Batches and serves Avro data from a topic @Tags Avro @ID avro-serve @Accept json @Produce application/vnd.apache.avro @Param name path string true "Topic Name" @Param records query int true "Record Count" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/avro/dequeue [get] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}" @Param records query int true "Number of records to collect" @Param name path string true "Topic Name"

func (RouteHandler) ListTopics

func (rt RouteHandler) ListTopics(c echo.Context) error

@Summary List Topics @Description Lists all topics in the gpq server @Tags Topics @ID list-topics @Produce json @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /management/topic/list [get] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) ParquetReceive

func (rt RouteHandler) ParquetReceive(c echo.Context) error

func (RouteHandler) ParquetServe

func (rt RouteHandler) ParquetServe(c echo.Context) error

func (RouteHandler) RawReceive

func (rt RouteHandler) RawReceive(c echo.Context) error

@Summary Receive Raw Data @Description Receives Raw data and enqueues it into a topic @Tags Raw @ID enqueue-raw @Accept application/octet-stream @Produce json @Param name path string true "Topic Name" @Param priority query int true "Priority" @Param should_escalate query bool true "Should Escalate" @Param escalate_every query string true "Escalate Every" @Param can_timeout query bool true "Can Timeout" @Param timeout_duration query string true "Timeout Duration" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/raw/enqueue [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) RawServe

func (rt RouteHandler) RawServe(c echo.Context) error

@Summary Serve Raw Data @Description Dequeues a message from the topic with highest priority @Tags Raw @ID raw-serve @Accept application/octet-stream @Produce application/octet-stream @Param name path string true "Topic Name" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /topic/{name}/raw/dequeue [get] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) RemoveTopic

func (rt RouteHandler) RemoveTopic(c echo.Context) error

@Summary Remove Topic @Description Removes a topic from the gpq server @Tags Topics @ID remove-topic @Accept json @Produce json @Param name query string true "Topic Name" @Success 200 {string} string "OK" @Failure 400 {string} string "Bad Request" @Router /management/topic/remove [post] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

func (RouteHandler) RemoveUser

func (rt RouteHandler) RemoveUser(c echo.Context) error

@Summary Remove User @Description Removes a user from the database @Tags Users @ID users-remove @Accept json @Produce json @Param username path string true "Username" @Success 200 {string} string "User removed" @Failure 400 {string} string "Bad Request" @Failure 403 {string} string "Forbidden" @Failure 404 {string} string "Not Found" @Failure 500 {string} string "Internal Server Error" @Router /settings/user/remove [delete] @Security ApiKeyAuth @Param Authorization header string true "Bearer {token}"

Jump to

Keyboard shortcuts

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