mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Object: use protobuf to declare the raw/summary types (#55646)
This commit is contained in:
21
pkg/services/store/object/generate.sh
Executable file
21
pkg/services/store/object/generate.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# To compile all protobuf files in this repository, run
|
||||
# "mage protobuf" at the top-level.
|
||||
|
||||
set -eu
|
||||
|
||||
#DST_DIR=../genproto/entity
|
||||
DST_DIR=./
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
protoc -I ./ \
|
||||
--go_out=${DST_DIR} \
|
||||
--go-grpc_out=${DST_DIR} --go-grpc_opt=require_unimplemented_servers=false \
|
||||
object.proto
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.21.5
|
||||
// source: object.proto
|
||||
|
||||
package object
|
||||
|
||||
|
||||
// Will be replaced with something from the SDK
|
||||
type UserInfo struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // internal grafana ID
|
||||
Login string `protobuf:"bytes,2,opt,name=login,proto3" json:"login,omitempty"` // string ID?
|
||||
}
|
||||
|
||||
// The canonical object/document data -- this represents the raw bytes and storage level metadata
|
||||
type RawObject struct {
|
||||
// Unique ID
|
||||
UID string `protobuf:"bytes,1,opt,name=UID,proto3" json:"UID,omitempty"`
|
||||
// Identify the object kind. This kind will be used to apply a schema to the body and
|
||||
// will trigger additional indexing behavior.
|
||||
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
// Time in epoch milliseconds that the object was modified
|
||||
Modified int64 `protobuf:"varint,3,opt,name=modified,proto3" json:"modified,omitempty"`
|
||||
// Who modified the object
|
||||
ModifiedBy *UserInfo `protobuf:"bytes,4,opt,name=modified_by,json=modifiedBy,proto3" json:"modified_by,omitempty"`
|
||||
// Content Length
|
||||
Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"`
|
||||
// MD5 digest of the body
|
||||
ETag string `protobuf:"bytes,6,opt,name=ETag,proto3" json:"ETag,omitempty"`
|
||||
// Raw bytes of the storage object. The kind will determine what is a valid payload
|
||||
Body []byte `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
|
||||
// The version will change when the object is saved. It is not necessarily sortable
|
||||
//
|
||||
// NOTE: currently managed by the dashboard+dashboard_version tables
|
||||
Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// optional "save" or "commit" message
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_version table, and will be returned from a "history" command
|
||||
Comment string `protobuf:"bytes,9,opt,name=comment,proto3" json:"comment,omitempty"`
|
||||
// Location (path/repo/etc) that defines the canonocal form
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_provisioning table
|
||||
SyncSrc string `protobuf:"bytes,10,opt,name=sync_src,json=syncSrc,proto3" json:"sync_src,omitempty"`
|
||||
// Time in epoch milliseconds that the object was last synced with an external system (provisioning/git)
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_provisioning table
|
||||
SyncTime int64 `protobuf:"varint,11,opt,name=sync_time,json=syncTime,proto3" json:"sync_time,omitempty"`
|
||||
}
|
||||
|
||||
// Searchable fields extracted from the object
|
||||
type ObjectErrorInfo struct {
|
||||
Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // TODO... registry somewhere... should be limited to most severe issues
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Details string `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
|
||||
}
|
||||
|
||||
type ExternalReference struct {
|
||||
// datasource, panel
|
||||
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
// prometheus / heatmap
|
||||
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// Unique ID for this object
|
||||
UID string `protobuf:"bytes,3,opt,name=UID,proto3" json:"UID,omitempty"`
|
||||
}
|
||||
1552
pkg/services/store/object/object.pb.go
Normal file
1552
pkg/services/store/object/object.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
257
pkg/services/store/object/object.proto
Normal file
257
pkg/services/store/object/object.proto
Normal file
@@ -0,0 +1,257 @@
|
||||
syntax = "proto3";
|
||||
package object;
|
||||
|
||||
option go_package = "./;object";
|
||||
|
||||
// Will be replaced with something from the SDK
|
||||
message UserInfo {
|
||||
// internal grafana user ID
|
||||
int64 id = 1;
|
||||
|
||||
// login name
|
||||
string login = 2; // string ID?
|
||||
}
|
||||
|
||||
// The canonical object/document data -- this represents the raw bytes and storage level metadata
|
||||
message RawObject {
|
||||
// Unique ID
|
||||
string UID = 1;
|
||||
|
||||
// Identify the object kind. This kind will be used to apply a schema to the body and
|
||||
// will trigger additional indexing behavior.
|
||||
string kind = 2;
|
||||
|
||||
// Time in epoch milliseconds that the object was created
|
||||
int64 created = 3;
|
||||
|
||||
// Time in epoch milliseconds that the object was modified
|
||||
int64 modified = 4;
|
||||
|
||||
// Who created the object
|
||||
UserInfo created_by = 5;
|
||||
|
||||
// Who modified the object
|
||||
UserInfo modified_by = 6;
|
||||
|
||||
// Content Length
|
||||
int64 size = 7;
|
||||
|
||||
// MD5 digest of the body
|
||||
string ETag = 8;
|
||||
|
||||
// Raw bytes of the storage object. The kind will determine what is a valid payload
|
||||
bytes body = 9;
|
||||
|
||||
// The version will change when the object is saved. It is not necessarily sortable
|
||||
//
|
||||
// NOTE: currently managed by the dashboard+dashboard_version tables
|
||||
string version = 10;
|
||||
|
||||
// optional "save" or "commit" message
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_version table, and will be returned from a "history" command
|
||||
string comment = 11;
|
||||
|
||||
// Location (path/repo/etc) that defines the canonocal form
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_provisioning table
|
||||
string sync_src = 12;
|
||||
|
||||
// Time in epoch milliseconds that the object was last synced with an external system (provisioning/git)
|
||||
//
|
||||
// NOTE: currently managed by the dashboard_provisioning table
|
||||
int64 sync_time = 13;
|
||||
}
|
||||
|
||||
// Report error while working with objects
|
||||
// NOTE: real systems at scale will contain errors.
|
||||
message ObjectErrorInfo {
|
||||
// Match an error code registry?
|
||||
int64 code = 1;
|
||||
|
||||
// Simple error display
|
||||
string message = 2;
|
||||
|
||||
// Details encoded in JSON
|
||||
bytes details_json = 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// Get request/response
|
||||
//-----------------------------------------------
|
||||
|
||||
message ReadObjectRequest {
|
||||
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string UID = 1;
|
||||
|
||||
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string kind = 2;
|
||||
|
||||
// Fetch an explicit version
|
||||
string version = 3;
|
||||
|
||||
// Include the full body bytes
|
||||
bool with_body = 4;
|
||||
|
||||
// Include derived summary metadata
|
||||
bool with_summary = 5;
|
||||
}
|
||||
|
||||
message ReadObjectResponse {
|
||||
// Object details with the body removed
|
||||
RawObject object = 1;
|
||||
|
||||
// Object summary as JSON
|
||||
bytes summary_json = 2;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// Make many read requests at once (by Kind+ID+version)
|
||||
//------------------------------------------------------
|
||||
|
||||
message BatchReadObjectRequest {
|
||||
repeated ReadObjectRequest batch = 3;
|
||||
}
|
||||
|
||||
message BatchReadObjectResponse {
|
||||
repeated ReadObjectResponse results = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// Write request/response
|
||||
//-----------------------------------------------
|
||||
|
||||
message WriteObjectRequest {
|
||||
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string UID = 1;
|
||||
|
||||
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string kind = 2;
|
||||
|
||||
// The raw object body
|
||||
bytes body = 3;
|
||||
|
||||
// Message that can be seen when exploring object history
|
||||
string comment = 4;
|
||||
|
||||
// Used for optimistic locking. If missing, the previous version will be replaced regardless
|
||||
string previous_version = 6;
|
||||
}
|
||||
|
||||
message WriteObjectResponse {
|
||||
// Error info -- if exists, the save did not happen
|
||||
ObjectErrorInfo error = 1;
|
||||
|
||||
// Object details with the body removed
|
||||
RawObject object = 2;
|
||||
|
||||
// Object summary as JSON
|
||||
bytes summary_json = 3;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// Delete request/response
|
||||
//-----------------------------------------------
|
||||
|
||||
message DeleteObjectRequest {
|
||||
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string UID = 1;
|
||||
|
||||
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string kind = 2;
|
||||
|
||||
// Used for optimistic locking. If missing, the previous version will be replaced regardless
|
||||
string previous_version = 3;
|
||||
}
|
||||
|
||||
message DeleteObjectResponse {
|
||||
bool OK = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// History request/response
|
||||
//-----------------------------------------------
|
||||
|
||||
message ObjectHistoryRequest {
|
||||
// Unique ID (Kind is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string UID = 1;
|
||||
|
||||
// Object kind (UID is also required) NOTE: UID+kind will likely be replaced with GRN that encodes both
|
||||
string kind = 2;
|
||||
|
||||
// Maximum number of items to return
|
||||
int64 limit = 3;
|
||||
|
||||
// Starting from the requested page
|
||||
string next_page_token = 5;
|
||||
}
|
||||
|
||||
message ObjectHistoryResponse {
|
||||
// Object metadata without the raw bytes
|
||||
repeated RawObject object = 1;
|
||||
|
||||
// More results exist... pass this in the next request
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// List request/response
|
||||
//-----------------------------------------------
|
||||
|
||||
message ObjectSearchRequest {
|
||||
// Starting from the requested page (other query parameters must match!)
|
||||
string next_page_token = 1;
|
||||
|
||||
// Maximum number of items to return
|
||||
int64 limit = 2;
|
||||
|
||||
// Free text query string -- mileage may vary :)
|
||||
string query = 3;
|
||||
|
||||
// limit to a specific kind (empty is all)
|
||||
repeated string kind = 4;
|
||||
|
||||
// Limit results to items in a specific folder
|
||||
string folder = 5;
|
||||
|
||||
// Must match all labels
|
||||
map<string,string> labels = 6;
|
||||
|
||||
// Sorting instructions `field ASC/DESC`
|
||||
repeated string sort = 7;
|
||||
|
||||
// TODO, limit the set of fields we actually want returned
|
||||
// Only supported in the QueryResponse flavor?
|
||||
repeated string fields = 8;
|
||||
|
||||
// Return the full body in each payload
|
||||
bool with_body = 9;
|
||||
}
|
||||
|
||||
message ObjectSearchResponse {
|
||||
repeated RawObject results = 1;
|
||||
|
||||
// More results exist... pass this in the next request
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// Storage interface
|
||||
//-----------------------------------------------
|
||||
|
||||
// This assumes a future grpc interface where the user info is passed in context, not in each message body
|
||||
// for now it will only work with an admin API key
|
||||
service ObjectStore {
|
||||
rpc Read(ReadObjectRequest) returns (ReadObjectResponse);
|
||||
rpc BatchRead(BatchReadObjectRequest) returns (BatchReadObjectResponse);
|
||||
rpc Write(WriteObjectRequest) returns (WriteObjectResponse);
|
||||
rpc Delete(DeleteObjectRequest) returns (DeleteObjectResponse);
|
||||
rpc History(ObjectHistoryRequest) returns (ObjectHistoryResponse);
|
||||
rpc Search(ObjectSearchRequest) returns (ObjectSearchResponse);
|
||||
|
||||
// Ideally an additional search endpoint with more flexibility to limit what you actually care about
|
||||
// https://github.com/grafana/grafana-plugin-sdk-go/blob/main/proto/backend.proto#L129
|
||||
// rpc SearchEX(ObjectSearchRequest) returns (DataResponse);
|
||||
}
|
||||
283
pkg/services/store/object/object_grpc.pb.go
Normal file
283
pkg/services/store/object/object_grpc.pb.go
Normal file
@@ -0,0 +1,283 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.21.5
|
||||
// source: object.proto
|
||||
|
||||
package object
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// ObjectStoreClient is the client API for ObjectStore service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ObjectStoreClient interface {
|
||||
Read(ctx context.Context, in *ReadObjectRequest, opts ...grpc.CallOption) (*ReadObjectResponse, error)
|
||||
BatchRead(ctx context.Context, in *BatchReadObjectRequest, opts ...grpc.CallOption) (*BatchReadObjectResponse, error)
|
||||
Write(ctx context.Context, in *WriteObjectRequest, opts ...grpc.CallOption) (*WriteObjectResponse, error)
|
||||
Delete(ctx context.Context, in *DeleteObjectRequest, opts ...grpc.CallOption) (*DeleteObjectResponse, error)
|
||||
History(ctx context.Context, in *ObjectHistoryRequest, opts ...grpc.CallOption) (*ObjectHistoryResponse, error)
|
||||
Search(ctx context.Context, in *ObjectSearchRequest, opts ...grpc.CallOption) (*ObjectSearchResponse, error)
|
||||
}
|
||||
|
||||
type objectStoreClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewObjectStoreClient(cc grpc.ClientConnInterface) ObjectStoreClient {
|
||||
return &objectStoreClient{cc}
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) Read(ctx context.Context, in *ReadObjectRequest, opts ...grpc.CallOption) (*ReadObjectResponse, error) {
|
||||
out := new(ReadObjectResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/Read", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) BatchRead(ctx context.Context, in *BatchReadObjectRequest, opts ...grpc.CallOption) (*BatchReadObjectResponse, error) {
|
||||
out := new(BatchReadObjectResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/BatchRead", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) Write(ctx context.Context, in *WriteObjectRequest, opts ...grpc.CallOption) (*WriteObjectResponse, error) {
|
||||
out := new(WriteObjectResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/Write", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) Delete(ctx context.Context, in *DeleteObjectRequest, opts ...grpc.CallOption) (*DeleteObjectResponse, error) {
|
||||
out := new(DeleteObjectResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/Delete", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) History(ctx context.Context, in *ObjectHistoryRequest, opts ...grpc.CallOption) (*ObjectHistoryResponse, error) {
|
||||
out := new(ObjectHistoryResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/History", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *objectStoreClient) Search(ctx context.Context, in *ObjectSearchRequest, opts ...grpc.CallOption) (*ObjectSearchResponse, error) {
|
||||
out := new(ObjectSearchResponse)
|
||||
err := c.cc.Invoke(ctx, "/object.ObjectStore/Search", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ObjectStoreServer is the server API for ObjectStore service.
|
||||
// All implementations should embed UnimplementedObjectStoreServer
|
||||
// for forward compatibility
|
||||
type ObjectStoreServer interface {
|
||||
Read(context.Context, *ReadObjectRequest) (*ReadObjectResponse, error)
|
||||
BatchRead(context.Context, *BatchReadObjectRequest) (*BatchReadObjectResponse, error)
|
||||
Write(context.Context, *WriteObjectRequest) (*WriteObjectResponse, error)
|
||||
Delete(context.Context, *DeleteObjectRequest) (*DeleteObjectResponse, error)
|
||||
History(context.Context, *ObjectHistoryRequest) (*ObjectHistoryResponse, error)
|
||||
Search(context.Context, *ObjectSearchRequest) (*ObjectSearchResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedObjectStoreServer should be embedded to have forward compatible implementations.
|
||||
type UnimplementedObjectStoreServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedObjectStoreServer) Read(context.Context, *ReadObjectRequest) (*ReadObjectResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Read not implemented")
|
||||
}
|
||||
func (UnimplementedObjectStoreServer) BatchRead(context.Context, *BatchReadObjectRequest) (*BatchReadObjectResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BatchRead not implemented")
|
||||
}
|
||||
func (UnimplementedObjectStoreServer) Write(context.Context, *WriteObjectRequest) (*WriteObjectResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Write not implemented")
|
||||
}
|
||||
func (UnimplementedObjectStoreServer) Delete(context.Context, *DeleteObjectRequest) (*DeleteObjectResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedObjectStoreServer) History(context.Context, *ObjectHistoryRequest) (*ObjectHistoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method History not implemented")
|
||||
}
|
||||
func (UnimplementedObjectStoreServer) Search(context.Context, *ObjectSearchRequest) (*ObjectSearchResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
|
||||
}
|
||||
|
||||
// UnsafeObjectStoreServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ObjectStoreServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeObjectStoreServer interface {
|
||||
mustEmbedUnimplementedObjectStoreServer()
|
||||
}
|
||||
|
||||
func RegisterObjectStoreServer(s grpc.ServiceRegistrar, srv ObjectStoreServer) {
|
||||
s.RegisterService(&ObjectStore_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ObjectStore_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReadObjectRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).Read(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/Read",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).Read(ctx, req.(*ReadObjectRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ObjectStore_BatchRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BatchReadObjectRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).BatchRead(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/BatchRead",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).BatchRead(ctx, req.(*BatchReadObjectRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ObjectStore_Write_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WriteObjectRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).Write(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/Write",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).Write(ctx, req.(*WriteObjectRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ObjectStore_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteObjectRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).Delete(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/Delete",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).Delete(ctx, req.(*DeleteObjectRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ObjectStore_History_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ObjectHistoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).History(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/History",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).History(ctx, req.(*ObjectHistoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ObjectStore_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ObjectSearchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ObjectStoreServer).Search(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/object.ObjectStore/Search",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ObjectStoreServer).Search(ctx, req.(*ObjectSearchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ObjectStore_ServiceDesc is the grpc.ServiceDesc for ObjectStore service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ObjectStore_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "object.ObjectStore",
|
||||
HandlerType: (*ObjectStoreServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Read",
|
||||
Handler: _ObjectStore_Read_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BatchRead",
|
||||
Handler: _ObjectStore_BatchRead_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Write",
|
||||
Handler: _ObjectStore_Write_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Delete",
|
||||
Handler: _ObjectStore_Delete_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "History",
|
||||
Handler: _ObjectStore_History_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Search",
|
||||
Handler: _ObjectStore_Search_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "object.proto",
|
||||
}
|
||||
@@ -24,6 +24,20 @@ type ObjectSummary struct {
|
||||
_ interface{}
|
||||
}
|
||||
|
||||
// Reference to another object outside itself
|
||||
// This message is derived from the object body and can be used to search for references.
|
||||
// This does not represent a method to declare a reference to another object.
|
||||
type ExternalReference struct {
|
||||
// datasource (instance), dashboard (instance),
|
||||
Kind string `json:"kind,omitempty"`
|
||||
|
||||
// prometheus / heatmap, heatamp|prometheus
|
||||
Type string `json:"type,omitempty"` // flavor
|
||||
|
||||
// Unique ID for this object
|
||||
UID string `json:"UID,omitempty"`
|
||||
}
|
||||
|
||||
// ObjectSummaryBuilder will read an object and create the summary.
|
||||
// This should not include values that depend on system state, only the raw object
|
||||
type ObjectSummaryBuilder = func(obj *RawObject) (ObjectSummary, error)
|
||||
|
||||
Reference in New Issue
Block a user