Documentation ¶
Overview ¶
Package api provide the RESTful APIs to interact with AresDB.
Schemes: http BasePath: / Version: 0.0.1 Consumes: - application/json Produces: - application/json
swagger:meta
Index ¶
- Constants
- Variables
- func ReadRequest(r *http.Request, obj interface{}) error
- func Respond(w http.ResponseWriter, obj interface{})
- func RespondBytesWithCode(w http.ResponseWriter, code int, bs []byte)
- func RespondJSONObjectWithCode(w http.ResponseWriter, code int, obj interface{})
- func RespondWithBadRequest(w http.ResponseWriter, err error)
- func RespondWithError(w http.ResponseWriter, err error)
- func RespondWithJSONBytes(w http.ResponseWriter, jsonBytes []byte, err error)
- func RespondWithJSONObject(w http.ResponseWriter, jsonObj interface{})
- type AQLRequest
- type AQLResponse
- type AddColumnRequest
- type AddEnumCaseRequest
- type AddEnumCaseResponse
- type AddTableRequest
- type ArchiveRequest
- type BackfillRequest
- type ContentType
- type DataHandler
- type DebugHandler
- func (handler *DebugHandler) Archive(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) Backfill(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) EvictVectorParty(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) Health(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) HealthSwitch(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ListRedoLogs(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ListUpsertBatches(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) LoadVectorParty(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) LookupPrimaryKey(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) Purge(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ReadBackfillQueueUpsertBatch(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ReadUpsertBatch(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) Register(router *mux.Router)
- func (handler *DebugHandler) ShowBatch(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ShowDeviceStatus(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ShowHostMemory(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ShowJobStatus(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) ShowShardMeta(w http.ResponseWriter, r *http.Request)
- func (handler *DebugHandler) Snapshot(w http.ResponseWriter, r *http.Request)
- type DeleteColumnRequest
- type DeleteTableRequest
- type EnumHandler
- type ErrorResponse
- type EvictVectorPartyRequest
- type GetTableRequest
- type GetTableResponse
- type HLLQueryResponseWriter
- func (w *HLLQueryResponseWriter) GetStatusCode() int
- func (w *HLLQueryResponseWriter) ReportError(queryIndex int, table string, err error, statusCode int)
- func (w *HLLQueryResponseWriter) ReportQueryContext(qc *query.AQLQueryContext)
- func (w *HLLQueryResponseWriter) ReportResult(queryIndex int, qc *query.AQLQueryContext)
- func (w *HLLQueryResponseWriter) Respond(rw http.ResponseWriter)
- type HealthCheckHandler
- type HealthSwitchRequest
- type JSONQueryResponseWriter
- func (w *JSONQueryResponseWriter) GetStatusCode() int
- func (w *JSONQueryResponseWriter) ReportError(queryIndex int, table string, err error, statusCode int)
- func (w *JSONQueryResponseWriter) ReportQueryContext(qc *query.AQLQueryContext)
- func (w *JSONQueryResponseWriter) ReportResult(queryIndex int, qc *query.AQLQueryContext)
- func (w *JSONQueryResponseWriter) Respond(rw http.ResponseWriter)
- type ListEnumCasesRequest
- type ListEnumCasesResponse
- type ListRedoLogsRequest
- type ListRedoLogsResponse
- type ListUpsertBatchesRequest
- type ListUpsertBatchesResponse
- type LoadVectorPartyRequest
- type LookupPrimaryKeyRequest
- type NoContentResponse
- type PanicHandler
- type PostDataRequest
- type PurgeRequest
- type QueryHandler
- type QueryResponseWriter
- type ReadBackfillQueueUpsertBatchRequest
- type ReadRedologUpsertBatchRequest
- type ReadUpsertBatchRequest
- type ReadUpsertBatchResponse
- type SchemaHandler
- func (handler *SchemaHandler) AddColumn(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) AddTable(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) DeleteColumn(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) DeleteTable(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) GetTable(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) ListTables(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
- func (handler *SchemaHandler) RegisterForDebug(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
- func (handler *SchemaHandler) UpdateColumn(w http.ResponseWriter, r *http.Request)
- func (handler *SchemaHandler) UpdateTableConfig(w http.ResponseWriter, r *http.Request)
- type ShardRequest
- type ShowBatchRequest
- type ShowBatchResponse
- type ShowJobStatusRequest
- type ShowShardMetaRequest
- type SnapshotRequest
- type StringArrayResponse
- type UpdateColumnRequest
- type UpdateTableConfigRequest
Constants ¶
const ( // ContentTypeUpsertBatch defines the upsert data content type. ContentTypeUpsertBatch = "application/upsert-data" // ContentTypeHyperLogLog defines the hyperloglog query result content type. ContentTypeHyperLogLog = "application/hll" // ContentTypeJSON defines the json content type. ContentTypeJSON = "application/json" )
Variables ¶
var ( // ErrMsgFailedToUnmarshalRequest represents error message for unmarshal error. ErrMsgFailedToUnmarshalRequest = "Bad request: failed to unmarshal request body" // ErrMsgMissingParameter represents error message for missing params error. ErrMsgMissingParameter = "Bad request: missing/invalid parameter" // ErrMsgFailedToReadRequestBody represents error message for unable to read request body error. ErrMsgFailedToReadRequestBody = "Bad request: failed to read request body" // ErrMsgNonExistentTable represents error message for table does not exist ErrMsgNonExistentTable = "Bad request: table does not exist" // ErrMsgNonExistentColumn represents error message for column does not exist ErrMsgNonExistentColumn = "Bad request: column does not exist" // ErrMsgDeletedColumn represents error message for column is already deleted ErrMsgDeletedColumn = "Bad request: column is already deleted" // ErrMsgNotImplemented represents error message for method not implemented. ErrMsgNotImplemented = "Not implemented" // ErrMsgFailedToJSONMarshalResponseBody respresents error message for failure to marshal // response body into json. ErrMsgFailedToJSONMarshalResponseBody = "Failed to marshal the response body into json" // ErrMissingParameter represents api error for missing parameter ErrMissingParameter = utils.APIError{ Code: http.StatusBadRequest, Message: ErrMsgMissingParameter, } // ErrNotImplemented represents api error for method not implemented. ErrNotImplemented = utils.APIError{ Code: http.StatusNotImplemented, Message: ErrMsgNotImplemented, } // ErrTableDoesNotExist represents api error for table does not exist. ErrTableDoesNotExist = utils.APIError{ Code: http.StatusBadRequest, Message: ErrMsgNonExistentTable, } // ErrColumnDoesNotExist represents api error for column does not exist. ErrColumnDoesNotExist = utils.APIError{ Code: http.StatusBadRequest, Message: ErrMsgNonExistentColumn, } // ErrColumnDeleted represents api error for column is already deleted. ErrColumnDeleted = utils.APIError{ Code: http.StatusBadRequest, Message: ErrMsgDeletedColumn, } // ErrBatchDoesNotExist represents api error for batch does not exist. ErrBatchDoesNotExist = utils.APIError{ Code: http.StatusBadRequest, Message: "Bad request: batch does not exist", } // ErrFailedToJSONMarshalResponseBody represents the api error for failure to marshal // response body into json. ErrFailedToJSONMarshalResponseBody = utils.APIError{ Code: http.StatusInternalServerError, Message: ErrMsgFailedToJSONMarshalResponseBody, } )
Functions ¶
func ReadRequest ¶
ReadRequest reads request. obj passed into this method has to be a pointer to a struct of request object Each request object will have path params tagged as `path:""` if needed and post body tagged as `body:""` if needed path tag must have parameter name, which will be used to read path param body tag field has to be a struct. eg.
type AddEnumCaseRequest struct { TableName string `path:"table"` ColumnName string `path:"column"` Body struct { EnumCase string `json:"enumCase"` } `body:""` }
func Respond ¶
func Respond(w http.ResponseWriter, obj interface{})
Respond responds with object with success status
func RespondBytesWithCode ¶
func RespondBytesWithCode(w http.ResponseWriter, code int, bs []byte)
RespondBytesWithCode with specified code and bytes.
func RespondJSONObjectWithCode ¶
func RespondJSONObjectWithCode(w http.ResponseWriter, code int, obj interface{})
RespondJSONObjectWithCode with specified code and object.
func RespondWithBadRequest ¶
func RespondWithBadRequest(w http.ResponseWriter, err error)
RespondWithBadRequest responds with StatusBadRequest as code.
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, err error)
RespondWithError responds with error.
func RespondWithJSONBytes ¶
func RespondWithJSONBytes(w http.ResponseWriter, jsonBytes []byte, err error)
RespondWithJSONBytes writes json bytes to response.
func RespondWithJSONObject ¶
func RespondWithJSONObject(w http.ResponseWriter, jsonObj interface{})
RespondWithJSONObject marshals the object into json bytes and write the bytes into response.
Types ¶
type AQLRequest ¶
type AQLRequest struct { // in: query Device int `query:"device,optional" json:"device"` // in: query Verbose int `query:"verbose,optional" json:"verbose"` // in: query Debug int `query:"debug,optional" json:"debug"` // in: query Profiling string `query:"profiling,optional" json:"profiling"` // in: query Query string `query:"q,optional" json:"q"` // in: query DeviceChoosingTimeout int `query:"timeout,optional" json:"timeout"` // in: header Accept string `header:"Accept" json:"accept"` // in: header Origin string `header:"Rpc-Caller" json:"origin"` // in: body Body query.AQLRequest `body:""` }
AQLRequest represents AQL query request. Debug mode will run **each batch** in synchronized mode and report time for each step. swagger:parameters queryAQL
type AQLResponse ¶
type AQLResponse struct { //in: body Body query.AQLResponse }
AQLResponse represents queryAQL response. swagger:response aqlResponse
type AddColumnRequest ¶
type AddColumnRequest struct { // in: path TableName string `path:"table" json:"table"` // in: body Body struct { // swagger:allOf metaCom.Column AddToArchivingSortOrder bool `json:"addToArchivingSortOrder,omitempty"` } `body:""` }
AddColumnRequest represents AddColumn request. swagger:parameters addColumn
type AddEnumCaseRequest ¶
type AddEnumCaseRequest struct { // in: path TableName string `path:"table" json:"table"` // in: path ColumnName string `path:"column" json:"column"` // in: body Body struct { EnumCases []string `json:"enumCases"` } `body:""` }
AddEnumCaseRequest represents AddEnumCase request. swagger:parameters addEnumCase
type AddEnumCaseResponse ¶
type AddEnumCaseResponse struct { //in: body Body []int }
AddEnumCaseResponse represents AddEnumCase response. swagger:response addEnumCaseResponse
type AddTableRequest ¶
AddTableRequest represents AddTable request. swagger:parameters addTable
type ArchiveRequest ¶
type ArchiveRequest struct { ShardRequest Body struct { Cutoff uint32 `json:"cutoff"` } `body:""` }
ArchiveRequest represents request to start an on demand archiving.
type BackfillRequest ¶
type BackfillRequest struct {
ShardRequest
}
BackfillRequest represents request to start an on demand backfill.
type DataHandler ¶
type DataHandler struct {
// contains filtered or unexported fields
}
DataHandler handles data ingestion requests from the ingestion pipeline.
func NewDataHandler ¶
func NewDataHandler(memStore memstore.MemStore) *DataHandler
NewDataHandler creates a new DataHandler.
func (*DataHandler) PostData ¶
func (handler *DataHandler) PostData(w http.ResponseWriter, r *http.Request)
PostData swagger:route POST /data/{table}/{shard} postData Post new data batch to a existing table shard Consumes:
- application/upsert-data
Responses:
default: errorResponse 200: noContentResponse
func (*DataHandler) Register ¶
func (handler *DataHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
Register registers http handlers.
type DebugHandler ¶
type DebugHandler struct {
// contains filtered or unexported fields
}
DebugHandler handles debug operations.
func NewDebugHandler ¶
func NewDebugHandler(memStore memstore.MemStore, metaStore metastore.MetaStore, queryHandler *QueryHandler, healthCheckHandler *HealthCheckHandler) *DebugHandler
NewDebugHandler returns a new DebugHandler.
func (*DebugHandler) Archive ¶
func (handler *DebugHandler) Archive(w http.ResponseWriter, r *http.Request)
Archive starts an archiving process on demand.
func (*DebugHandler) Backfill ¶
func (handler *DebugHandler) Backfill(w http.ResponseWriter, r *http.Request)
Backfill starts an backfill process on demand.
func (*DebugHandler) EvictVectorParty ¶
func (handler *DebugHandler) EvictVectorParty(w http.ResponseWriter, r *http.Request)
EvictVectorParty evict a vector party from memory.
func (*DebugHandler) Health ¶
func (handler *DebugHandler) Health(w http.ResponseWriter, r *http.Request)
Health returns whether the health check is on or off
func (*DebugHandler) HealthSwitch ¶
func (handler *DebugHandler) HealthSwitch(w http.ResponseWriter, r *http.Request)
HealthSwitch will turn on health check based on the request.
func (*DebugHandler) ListRedoLogs ¶
func (handler *DebugHandler) ListRedoLogs(w http.ResponseWriter, r *http.Request)
ListRedoLogs lists all the redo log files for a given shard.
func (*DebugHandler) ListUpsertBatches ¶
func (handler *DebugHandler) ListUpsertBatches(w http.ResponseWriter, r *http.Request)
ListUpsertBatches returns offsets of upsert batches in the redo log file.
func (*DebugHandler) LoadVectorParty ¶
func (handler *DebugHandler) LoadVectorParty(w http.ResponseWriter, r *http.Request)
LoadVectorParty requests a vector party from disk if it is not already in memory
func (*DebugHandler) LookupPrimaryKey ¶
func (handler *DebugHandler) LookupPrimaryKey(w http.ResponseWriter, r *http.Request)
LookupPrimaryKey looks up a key in primary key for given table and shard
func (*DebugHandler) Purge ¶
func (handler *DebugHandler) Purge(w http.ResponseWriter, r *http.Request)
Purge starts an purge process on demand.
func (*DebugHandler) ReadBackfillQueueUpsertBatch ¶
func (handler *DebugHandler) ReadBackfillQueueUpsertBatch(w http.ResponseWriter, r *http.Request)
ReadBackfillQueueUpsertBatch reads upsert batch inside backfill manager backfill queue
func (*DebugHandler) ReadUpsertBatch ¶
func (handler *DebugHandler) ReadUpsertBatch(w http.ResponseWriter, r *http.Request)
ReadUpsertBatch shows the records of an upsert batch given a redolog file creation time and upsert batch index within the file.
func (*DebugHandler) Register ¶
func (handler *DebugHandler) Register(router *mux.Router)
Register registers http handlers.
func (*DebugHandler) ShowBatch ¶
func (handler *DebugHandler) ShowBatch(w http.ResponseWriter, r *http.Request)
ShowBatch will only show batches that is present in memory, it will not request batch from DiskStore.
func (*DebugHandler) ShowDeviceStatus ¶
func (handler *DebugHandler) ShowDeviceStatus(w http.ResponseWriter, r *http.Request)
ShowDeviceStatus shows the current scheduler status.
func (*DebugHandler) ShowHostMemory ¶
func (handler *DebugHandler) ShowHostMemory(w http.ResponseWriter, r *http.Request)
ShowHostMemory shows the current host memory usage
func (*DebugHandler) ShowJobStatus ¶
func (handler *DebugHandler) ShowJobStatus(w http.ResponseWriter, r *http.Request)
ShowJobStatus shows the current archive job status.
func (*DebugHandler) ShowShardMeta ¶
func (handler *DebugHandler) ShowShardMeta(w http.ResponseWriter, r *http.Request)
ShowShardMeta shows the metadata for a table shard. It won't show the underlying data.
func (*DebugHandler) Snapshot ¶
func (handler *DebugHandler) Snapshot(w http.ResponseWriter, r *http.Request)
Snapshot starts an snapshot process on demand.
type DeleteColumnRequest ¶
type DeleteColumnRequest struct { // in: path TableName string `path:"table" json:"table"` // in: path ColumnName string `path:"column" json:"column"` }
DeleteColumnRequest represents DeleteColumn request. swagger:parameters deleteColumn
type DeleteTableRequest ¶
type DeleteTableRequest struct { // in: path TableName string `path:"table" json:"table"` }
DeleteTableRequest represents DeleteTable request. swagger:parameters deleteTable
type EnumHandler ¶
type EnumHandler struct {
// contains filtered or unexported fields
}
EnumHandler handlers enum rw
func NewEnumHandler ¶
func NewEnumHandler(memStore memstore.MemStore, metastore metastore.MetaStore) *EnumHandler
NewEnumHandler returns a new enum handler
func (*EnumHandler) AddEnumCase ¶
func (handler *EnumHandler) AddEnumCase(w http.ResponseWriter, r *http.Request)
AddEnumCase swagger:route POST /schema/tables/{table}/columns/{column}/enum-cases addEnumCase add an enum case to given column of given table return the id of the enum
Responses:
default: errorResponse 200: addEnumCaseResponse
func (*EnumHandler) ListEnumCases ¶
func (handler *EnumHandler) ListEnumCases(w http.ResponseWriter, r *http.Request)
ListEnumCases swagger:route GET /schema/tables/{table}/columns/{column}/enum-cases listEnumCases list existing enumCases for given table and column
Responses:
default: errorResponse 200: listEnumCasesResponse
func (*EnumHandler) Register ¶
func (handler *EnumHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
Register regists paths
type ErrorResponse ¶
ErrorResponse represents error response. swagger:response errorResponse
type EvictVectorPartyRequest ¶
type EvictVectorPartyRequest struct {
LoadVectorPartyRequest
}
EvictVectorPartyRequest represents a evict request for vector party
type GetTableRequest ¶
type GetTableRequest struct { //in: path TableName string `path:"table" json:"table"` }
GetTableRequest represents GetTable request. swagger:parameters getTable
type GetTableResponse ¶
GetTableResponse represents GetTable response. swagger:response getTableResponse
type HLLQueryResponseWriter ¶
type HLLQueryResponseWriter struct {
// contains filtered or unexported fields
}
HLLQueryResponseWriter writes query result as application/hll. For more inforamtion, please refer to https://github.com/uber/aresdb/wiki/HyperLogLog.
func (*HLLQueryResponseWriter) GetStatusCode ¶
func (w *HLLQueryResponseWriter) GetStatusCode() int
GetStatusCode returns the status code written into response.
func (*HLLQueryResponseWriter) ReportError ¶
func (w *HLLQueryResponseWriter) ReportError(queryIndex int, table string, err error, statusCode int)
ReportError writes the error of the query to the response.
func (*HLLQueryResponseWriter) ReportQueryContext ¶
func (w *HLLQueryResponseWriter) ReportQueryContext(qc *query.AQLQueryContext)
ReportQueryContext writes the query context to the response. Since the format of application/hll is not designed for human reading, we will ignore storing query context in response for now.
func (*HLLQueryResponseWriter) ReportResult ¶
func (w *HLLQueryResponseWriter) ReportResult(queryIndex int, qc *query.AQLQueryContext)
ReportResult writes the query result to the response.
func (*HLLQueryResponseWriter) Respond ¶
func (w *HLLQueryResponseWriter) Respond(rw http.ResponseWriter)
Respond writes the final response into ResponseWriter.
type HealthCheckHandler ¶
HealthCheckHandler http handler for health check.
func NewHealthCheckHandler ¶
func NewHealthCheckHandler() *HealthCheckHandler
NewHealthCheckHandler return a new http handler for health check.
func (*HealthCheckHandler) HealthCheck ¶
func (handler *HealthCheckHandler) HealthCheck(w http.ResponseWriter, r *http.Request)
HealthCheck is the HealthCheck endpoint.
func (*HealthCheckHandler) Version ¶
func (handler *HealthCheckHandler) Version(w http.ResponseWriter, r *http.Request)
Version is the Version check endpoint.
type HealthSwitchRequest ¶
type HealthSwitchRequest struct {
OnOrOff string `path:"onOrOff" json:"onOrOff"`
}
HealthSwitchRequest represents the request to turn on/off the health check.
type JSONQueryResponseWriter ¶
type JSONQueryResponseWriter struct {
// contains filtered or unexported fields
}
JSONQueryResponseWriter writes query result as json.
func (*JSONQueryResponseWriter) GetStatusCode ¶
func (w *JSONQueryResponseWriter) GetStatusCode() int
GetStatusCode returns the status code written into response.
func (*JSONQueryResponseWriter) ReportError ¶
func (w *JSONQueryResponseWriter) ReportError(queryIndex int, table string, err error, statusCode int)
ReportError writes the error of the query to the response.
func (*JSONQueryResponseWriter) ReportQueryContext ¶
func (w *JSONQueryResponseWriter) ReportQueryContext(qc *query.AQLQueryContext)
ReportQueryContext writes the query context to the response.
func (*JSONQueryResponseWriter) ReportResult ¶
func (w *JSONQueryResponseWriter) ReportResult(queryIndex int, qc *query.AQLQueryContext)
ReportResult writes the query result to the response.
func (*JSONQueryResponseWriter) Respond ¶
func (w *JSONQueryResponseWriter) Respond(rw http.ResponseWriter)
Respond writes the final response into ResponseWriter.
type ListEnumCasesRequest ¶
type ListEnumCasesRequest struct { // in: path TableName string `path:"table" json:"table"` // in: path ColumnName string `path:"column" json:"column"` }
ListEnumCasesRequest represents ListEnumCases request. swagger:parameters listEnumCases
type ListEnumCasesResponse ¶
ListEnumCasesResponse represents ListEnumCases response. swagger:response listEnumCasesResponse
type ListRedoLogsRequest ¶
type ListRedoLogsRequest struct {
ShardRequest
}
ListRedoLogsRequest represents the request to list all redo log files for a given shard.
type ListRedoLogsResponse ¶
type ListRedoLogsResponse []string
ListRedoLogsResponse represents the ListRedoLogs response.
type ListUpsertBatchesRequest ¶
type ListUpsertBatchesRequest struct { ShardRequest // CreationTime of the redolog file. CreationTime int64 `path:"creationTime"` }
ListUpsertBatchesRequest represents the request to list offsets of upsert batches in a redo log file.
type ListUpsertBatchesResponse ¶
type ListUpsertBatchesResponse []int64
ListUpsertBatchesResponse represents the ListUpsertBatches response.
type LoadVectorPartyRequest ¶
type LoadVectorPartyRequest struct { ShardRequest BatchID int `path:"batch" json:"batch"` ColumnName string `path:"column" json:"column"` }
LoadVectorPartyRequest represents a load request for vector party
type LookupPrimaryKeyRequest ¶
type LookupPrimaryKeyRequest struct { ShardRequest // comma delimited string Key string `query:"key" json:"key"` }
LookupPrimaryKeyRequest represents primary key lookup request
type NoContentResponse ¶
type NoContentResponse struct{}
NoContentResponse represents Response with no content. swagger:response noContentResponse
type PanicHandler ¶
type PanicHandler struct {
// contains filtered or unexported fields
}
PanicHandler is a wrapper handler for handling panic in http request handling
func WithPanicHandling ¶
func WithPanicHandling(handler http.Handler) PanicHandler
WithPanicHandling will apply panic handler to regular http handler.
func (PanicHandler) ServeHTTP ¶
func (handler PanicHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
ServeHTTP serves http request for PanicHandler.
type PostDataRequest ¶
type PostDataRequest struct { // in: path TableName string `path:"table" json:"table"` // in: path Shard int `path:"shard" json:"shard"` // in: body Body []byte `body:""` }
PostDataRequest represents post data request. swagger:parameters postData
type PurgeRequest ¶
type PurgeRequest struct { ShardRequest Body struct { BatchIDStart int `json:"batchIDStart"` BatchIDEnd int `json:"batchIDEnd"` SafePurge bool `json:"safePurge"` } `body:""` }
PurgeRequest represents request to purge a batch.
type QueryHandler ¶
type QueryHandler struct {
// contains filtered or unexported fields
}
QueryHandler handles query execution.
func NewQueryHandler ¶
func NewQueryHandler(memStore memstore.MemStore, cfg common.QueryConfig) *QueryHandler
NewQueryHandler creates a new QueryHandler.
func (*QueryHandler) GetDeviceManager ¶
func (handler *QueryHandler) GetDeviceManager() *query.DeviceManager
GetDeviceManager returns the device manager of query handler.
func (*QueryHandler) HandleAQL ¶
func (handler *QueryHandler) HandleAQL(w http.ResponseWriter, r *http.Request)
HandleAQL swagger:route POST /query/aql queryAQL query in AQL
Consumes:
- application/json
- application/hll
Produces:
- application/json
Responses:
default: errorResponse 200: aqlResponse 400: aqlResponse
func (*QueryHandler) Register ¶
func (handler *QueryHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
Register registers http handlers.
type QueryResponseWriter ¶
type QueryResponseWriter interface { ReportError(queryIndex int, table string, err error, statusCode int) ReportQueryContext(*query.AQLQueryContext) ReportResult(int, *query.AQLQueryContext) Respond(w http.ResponseWriter) GetStatusCode() int }
QueryResponseWriter defines the interface to write query result and error to final response.
func NewHLLQueryResponseWriter ¶
func NewHLLQueryResponseWriter() QueryResponseWriter
NewHLLQueryResponseWriter creates a new HLLQueryResponseWriter.
func NewJSONQueryResponseWriter ¶
func NewJSONQueryResponseWriter(nQueries int) QueryResponseWriter
NewJSONQueryResponseWriter creates a new JSONQueryResponseWriter.
type ReadBackfillQueueUpsertBatchRequest ¶
type ReadBackfillQueueUpsertBatchRequest struct { ShardRequest ReadUpsertBatchRequest }
ReadBackfillQueueUpsertBatchRequest represents the request to show one page of current upsert batch of backfill queue
type ReadRedologUpsertBatchRequest ¶
type ReadRedologUpsertBatchRequest struct { ListUpsertBatchesRequest ReadUpsertBatchRequest }
ReadRedologUpsertBatchRequest represents the request to show one page of current upsert batch of a given redolog file.
type ReadUpsertBatchRequest ¶
type ReadUpsertBatchRequest struct { // Offset of upsert batch. Offset int64 `path:"offset"` // Start of records in upsert batch in this page. Start int `query:"start,optional"` // Number of records to show in this page. If length is 0, it means caller only want to // get another metadata of this upsert batch. Length int `query:"length,optional"` // Draw is the counter that this object is a response to. Draw int `query:"draw,optional"` }
ReadUpsertBatchRequest represents the request to show one page of current upsert batch
type ReadUpsertBatchResponse ¶
type ReadUpsertBatchResponse struct { Data [][]interface{} `json:"data"` ColumnNames []string `json:"columnNames"` RecordsFiltered int `json:"recordsFiltered"` RecordsTotal int `json:"recordsTotal"` Draw int `json:"draw"` Error string `json:"error"` }
ReadUpsertBatchResponse represents ReadUpsertBatch response.
type SchemaHandler ¶
type SchemaHandler struct {
// contains filtered or unexported fields
}
SchemaHandler handles schema http requests.
func NewSchemaHandler ¶
func NewSchemaHandler(metaStore metastore.MetaStore) *SchemaHandler
NewSchemaHandler will create a new SchemaHandler with memStore and metaStore.
func (*SchemaHandler) AddColumn ¶
func (handler *SchemaHandler) AddColumn(w http.ResponseWriter, r *http.Request)
AddColumn swagger:route POST /schema/tables/{table}/columns addColumn add a single column to existing table
Consumes:
- application/json
Responses:
default: errorResponse 200: noContentResponse
func (*SchemaHandler) AddTable ¶
func (handler *SchemaHandler) AddTable(w http.ResponseWriter, r *http.Request)
AddTable swagger:route POST /schema/tables addTable add table to table collections
Consumes:
- application/json
Responses:
default: errorResponse 200: noContentResponse
func (*SchemaHandler) DeleteColumn ¶
func (handler *SchemaHandler) DeleteColumn(w http.ResponseWriter, r *http.Request)
DeleteColumn swagger:route DELETE /schema/tables/{table}/columns/{column} deleteColumn delete columns from existing table
Responses:
default: errorResponse 200: noContentResponse
func (*SchemaHandler) DeleteTable ¶
func (handler *SchemaHandler) DeleteTable(w http.ResponseWriter, r *http.Request)
DeleteTable swagger:route DELETE /schema/tables/{table} deleteTable delete table from metaStore
Responses:
default: errorResponse 200: noContentResponse
func (*SchemaHandler) GetTable ¶
func (handler *SchemaHandler) GetTable(w http.ResponseWriter, r *http.Request)
GetTable swagger:route GET /schema/tables/{table} getTable get the table schema for specific table name
Consumes:
- application/json
Produces:
- application/json
Responses:
default: errorResponse 200: getTableResponse
func (*SchemaHandler) ListTables ¶
func (handler *SchemaHandler) ListTables(w http.ResponseWriter, r *http.Request)
ListTables swagger:route GET /schema/tables listTables List all table schemas Consumes:
- application/json
Produces:
- application/json
Responses:
default: errorResponse 200: stringArrayResponse
func (*SchemaHandler) Register ¶
func (handler *SchemaHandler) Register(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
Register registers http handlers.
func (*SchemaHandler) RegisterForDebug ¶
func (handler *SchemaHandler) RegisterForDebug(router *mux.Router, wrappers ...utils.HTTPHandlerWrapper)
RegisterForDebug register handlers for debug port
func (*SchemaHandler) UpdateColumn ¶
func (handler *SchemaHandler) UpdateColumn(w http.ResponseWriter, r *http.Request)
UpdateColumn swagger:route PUT /schema/tables/{table}/columns/{column} updateColumn update specified column
Consumes:
- application/json
Responses:
default: errorResponse 200: noContentResponse
func (*SchemaHandler) UpdateTableConfig ¶
func (handler *SchemaHandler) UpdateTableConfig(w http.ResponseWriter, r *http.Request)
UpdateTableConfig swagger:route PUT /schema/tables/{table} updateTableConfig update config of the specified table
Consumes:
- application/json
Responses:
default: errorResponse 200: noContentResponse
type ShardRequest ¶
type ShardRequest struct { TableName string `path:"table" json:"table"` ShardID int `path:"shard" json:"shard"` }
ShardRequest is the common request struct for all shard related operations.
type ShowBatchRequest ¶
type ShowBatchRequest struct { ShardRequest BatchID int `path:"batch" json:"batch"` StartRow int `query:"startRow,optional" json:"startRow"` NumRows int `query:"numRows,optional" json:"numRows"` }
ShowBatchRequest represents request to show a batch.
type ShowBatchResponse ¶
type ShowBatchResponse struct { Body struct { Columns []string `json:"columns"` Types []string `json:"types"` Deleted []int `json:"deleted"` Vectors []common.SlicedVector `json:"vectors"` StartRow int `json:"startRow"` NumRows int `json:"numRows"` } }
ShowBatchResponse represents ShowBatch response.
type ShowJobStatusRequest ¶
type ShowJobStatusRequest struct {
JobType string `path:"jobType" json:"jobType"`
}
ShowJobStatusRequest represents the request to show job statuses for a given job type.
type ShowShardMetaRequest ¶
type ShowShardMetaRequest struct {
ShardRequest
}
ShowShardMetaRequest represents request to show metadata for a shard.
type SnapshotRequest ¶
type SnapshotRequest struct {
ShardRequest
}
SnapshotRequest represents request to start an on demand snapshot.
type StringArrayResponse ¶
type StringArrayResponse struct { //in: body Body []string }
StringArrayResponse represents string array response. swagger:response stringArrayResponse
func NewStringArrayResponse ¶
func NewStringArrayResponse() StringArrayResponse
NewStringArrayResponse creates a StringArrayResponse.
type UpdateColumnRequest ¶
type UpdateColumnRequest struct { // in: path TableName string `path:"table" json:"table"` // in: path ColumnName string `path:"column" json:"column"` // in: body Body metaCom.ColumnConfig `body:""` }
UpdateColumnRequest represents UpdateColumn request. Supported for updates:
preloadingDays priority
swagger:parameters updateColumn
type UpdateTableConfigRequest ¶
type UpdateTableConfigRequest struct { // in: path TableName string `path:"table" json:"table"` // in: body Body metaCom.TableConfig `body:""` }
UpdateTableConfigRequest represents UpdateTableConfig request. swagger:parameters updateTableConfig