1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] StorageV2 Integration Service Definition (#1754)

This commit is contained in:
Adam Janikowski 2024-11-01 12:09:36 +01:00 committed by GitHub
parent 0a339b413c
commit 4a87f8a856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1518 additions and 0 deletions

View file

@ -10,6 +10,7 @@
- (Feature) (Integration) Basic Envs
- (Maintenance) Inspector Generics
- (Bugfix) Fix Gateway Options
- (Feature) StorageV2 Integration Service Definition
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
- (Feature) ArangoRoute CRD

View file

@ -0,0 +1,25 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package definition
const (
Name = "storage.v2"
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,129 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
syntax = "proto3";
package shutdown;
import "google/protobuf/timestamp.proto";
option go_package = "github.com/arangodb/kube-arangodb/integrations/storage/v2/definition";
// Defines StorageV2 Service
service StorageV2 {
// Allows to Read Objects using stream
rpc ReadObject(StorageV2ReadObjectRequest) returns (stream StorageV2ReadObjectResponse);
// Allows to Write Objects using stream
rpc WriteObject(stream StorageV2WriteObjectRequest) returns (StorageV2WriteObjectResponse);
// Gets basic info about object
rpc HeadObject(StorageV2HeadObjectRequest) returns (StorageV2HeadObjectResponse);
// Deletes object
rpc DeleteObject(StorageV2DeleteObjectRequest) returns (StorageV2DeleteObjectResponse);
// List all objects in batches
rpc ListObjects(StorageV2ListObjectsRequest) returns (stream StorageV2ListObjectsResponse);
}
// Defines Object Path/Key
message StorageV2Path {
// Defines Object Path/Key
string path = 1;
}
// Defines Object Details
message StorageV2Object {
// Defines Object Path/Key
StorageV2Path path = 1;
// Defines Object Info
StorageV2ObjectInfo info = 2;
}
// Defines Object Info
message StorageV2ObjectInfo {
// Size in bytes of the object
uint64 size = 1;
// Timestamp of last update
google.protobuf.Timestamp last_updated = 2;
}
// StorageV2 ReadObject Request
message StorageV2ReadObjectRequest {
// Defines Object Path/Key
StorageV2Path path = 1;
}
// StorageV2 ReadObject Response
message StorageV2ReadObjectResponse {
// Bytes of the object
bytes chunk = 1;
}
// StorageV2 WriteObject Request
message StorageV2WriteObjectRequest {
// Defines Object Path/Key
StorageV2Path path = 1;
// Bytes of the object
bytes chunk = 2;
}
// StorageV2 WriteObject Response
message StorageV2WriteObjectResponse {
// Bytes Saved
int64 bytes =1;
// Checksum (sha256) of the object
string checksum = 2;
}
// StorageV2 HeadObject Request
message StorageV2HeadObjectRequest {
// Defines Object Path/Key
StorageV2Path path = 1;
}
// StorageV2 HeadObject Response
message StorageV2HeadObjectResponse {
// Defines Object Info
StorageV2ObjectInfo info = 1;
}
// StorageV2 DeleteObject Request
message StorageV2DeleteObjectRequest {
// Defines Object Path/Key
StorageV2Path path = 1;
}
// StorageV2 DeleteObject Response
message StorageV2DeleteObjectResponse {
}
// StorageV2 ListObjects Request
message StorageV2ListObjectsRequest {
// Defines Object Path/Key
StorageV2Path path = 1;
}
// StorageV2 ListObjects Response
message StorageV2ListObjectsResponse {
// List of the objects
repeated StorageV2Object files = 1;
}

View file

@ -0,0 +1,338 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.1
// source: integrations/storage/v2/definition/storage.proto
package definition
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
// StorageV2Client is the client API for StorageV2 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 StorageV2Client interface {
ReadObject(ctx context.Context, in *StorageV2ReadObjectRequest, opts ...grpc.CallOption) (StorageV2_ReadObjectClient, error)
WriteObject(ctx context.Context, opts ...grpc.CallOption) (StorageV2_WriteObjectClient, error)
HeadObject(ctx context.Context, in *StorageV2HeadObjectRequest, opts ...grpc.CallOption) (*StorageV2HeadObjectResponse, error)
DeleteObject(ctx context.Context, in *StorageV2DeleteObjectRequest, opts ...grpc.CallOption) (*StorageV2DeleteObjectResponse, error)
ListObjects(ctx context.Context, in *StorageV2ListObjectsRequest, opts ...grpc.CallOption) (StorageV2_ListObjectsClient, error)
}
type storageV2Client struct {
cc grpc.ClientConnInterface
}
func NewStorageV2Client(cc grpc.ClientConnInterface) StorageV2Client {
return &storageV2Client{cc}
}
func (c *storageV2Client) ReadObject(ctx context.Context, in *StorageV2ReadObjectRequest, opts ...grpc.CallOption) (StorageV2_ReadObjectClient, error) {
stream, err := c.cc.NewStream(ctx, &StorageV2_ServiceDesc.Streams[0], "/shutdown.StorageV2/ReadObject", opts...)
if err != nil {
return nil, err
}
x := &storageV2ReadObjectClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type StorageV2_ReadObjectClient interface {
Recv() (*StorageV2ReadObjectResponse, error)
grpc.ClientStream
}
type storageV2ReadObjectClient struct {
grpc.ClientStream
}
func (x *storageV2ReadObjectClient) Recv() (*StorageV2ReadObjectResponse, error) {
m := new(StorageV2ReadObjectResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *storageV2Client) WriteObject(ctx context.Context, opts ...grpc.CallOption) (StorageV2_WriteObjectClient, error) {
stream, err := c.cc.NewStream(ctx, &StorageV2_ServiceDesc.Streams[1], "/shutdown.StorageV2/WriteObject", opts...)
if err != nil {
return nil, err
}
x := &storageV2WriteObjectClient{stream}
return x, nil
}
type StorageV2_WriteObjectClient interface {
Send(*StorageV2WriteObjectRequest) error
CloseAndRecv() (*StorageV2WriteObjectResponse, error)
grpc.ClientStream
}
type storageV2WriteObjectClient struct {
grpc.ClientStream
}
func (x *storageV2WriteObjectClient) Send(m *StorageV2WriteObjectRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *storageV2WriteObjectClient) CloseAndRecv() (*StorageV2WriteObjectResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(StorageV2WriteObjectResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *storageV2Client) HeadObject(ctx context.Context, in *StorageV2HeadObjectRequest, opts ...grpc.CallOption) (*StorageV2HeadObjectResponse, error) {
out := new(StorageV2HeadObjectResponse)
err := c.cc.Invoke(ctx, "/shutdown.StorageV2/HeadObject", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *storageV2Client) DeleteObject(ctx context.Context, in *StorageV2DeleteObjectRequest, opts ...grpc.CallOption) (*StorageV2DeleteObjectResponse, error) {
out := new(StorageV2DeleteObjectResponse)
err := c.cc.Invoke(ctx, "/shutdown.StorageV2/DeleteObject", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *storageV2Client) ListObjects(ctx context.Context, in *StorageV2ListObjectsRequest, opts ...grpc.CallOption) (StorageV2_ListObjectsClient, error) {
stream, err := c.cc.NewStream(ctx, &StorageV2_ServiceDesc.Streams[2], "/shutdown.StorageV2/ListObjects", opts...)
if err != nil {
return nil, err
}
x := &storageV2ListObjectsClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type StorageV2_ListObjectsClient interface {
Recv() (*StorageV2ListObjectsResponse, error)
grpc.ClientStream
}
type storageV2ListObjectsClient struct {
grpc.ClientStream
}
func (x *storageV2ListObjectsClient) Recv() (*StorageV2ListObjectsResponse, error) {
m := new(StorageV2ListObjectsResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// StorageV2Server is the server API for StorageV2 service.
// All implementations must embed UnimplementedStorageV2Server
// for forward compatibility
type StorageV2Server interface {
ReadObject(*StorageV2ReadObjectRequest, StorageV2_ReadObjectServer) error
WriteObject(StorageV2_WriteObjectServer) error
HeadObject(context.Context, *StorageV2HeadObjectRequest) (*StorageV2HeadObjectResponse, error)
DeleteObject(context.Context, *StorageV2DeleteObjectRequest) (*StorageV2DeleteObjectResponse, error)
ListObjects(*StorageV2ListObjectsRequest, StorageV2_ListObjectsServer) error
mustEmbedUnimplementedStorageV2Server()
}
// UnimplementedStorageV2Server must be embedded to have forward compatible implementations.
type UnimplementedStorageV2Server struct {
}
func (UnimplementedStorageV2Server) ReadObject(*StorageV2ReadObjectRequest, StorageV2_ReadObjectServer) error {
return status.Errorf(codes.Unimplemented, "method ReadObject not implemented")
}
func (UnimplementedStorageV2Server) WriteObject(StorageV2_WriteObjectServer) error {
return status.Errorf(codes.Unimplemented, "method WriteObject not implemented")
}
func (UnimplementedStorageV2Server) HeadObject(context.Context, *StorageV2HeadObjectRequest) (*StorageV2HeadObjectResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HeadObject not implemented")
}
func (UnimplementedStorageV2Server) DeleteObject(context.Context, *StorageV2DeleteObjectRequest) (*StorageV2DeleteObjectResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteObject not implemented")
}
func (UnimplementedStorageV2Server) ListObjects(*StorageV2ListObjectsRequest, StorageV2_ListObjectsServer) error {
return status.Errorf(codes.Unimplemented, "method ListObjects not implemented")
}
func (UnimplementedStorageV2Server) mustEmbedUnimplementedStorageV2Server() {}
// UnsafeStorageV2Server may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to StorageV2Server will
// result in compilation errors.
type UnsafeStorageV2Server interface {
mustEmbedUnimplementedStorageV2Server()
}
func RegisterStorageV2Server(s grpc.ServiceRegistrar, srv StorageV2Server) {
s.RegisterService(&StorageV2_ServiceDesc, srv)
}
func _StorageV2_ReadObject_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StorageV2ReadObjectRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(StorageV2Server).ReadObject(m, &storageV2ReadObjectServer{stream})
}
type StorageV2_ReadObjectServer interface {
Send(*StorageV2ReadObjectResponse) error
grpc.ServerStream
}
type storageV2ReadObjectServer struct {
grpc.ServerStream
}
func (x *storageV2ReadObjectServer) Send(m *StorageV2ReadObjectResponse) error {
return x.ServerStream.SendMsg(m)
}
func _StorageV2_WriteObject_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(StorageV2Server).WriteObject(&storageV2WriteObjectServer{stream})
}
type StorageV2_WriteObjectServer interface {
SendAndClose(*StorageV2WriteObjectResponse) error
Recv() (*StorageV2WriteObjectRequest, error)
grpc.ServerStream
}
type storageV2WriteObjectServer struct {
grpc.ServerStream
}
func (x *storageV2WriteObjectServer) SendAndClose(m *StorageV2WriteObjectResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *storageV2WriteObjectServer) Recv() (*StorageV2WriteObjectRequest, error) {
m := new(StorageV2WriteObjectRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _StorageV2_HeadObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StorageV2HeadObjectRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StorageV2Server).HeadObject(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/shutdown.StorageV2/HeadObject",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StorageV2Server).HeadObject(ctx, req.(*StorageV2HeadObjectRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StorageV2_DeleteObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StorageV2DeleteObjectRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StorageV2Server).DeleteObject(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/shutdown.StorageV2/DeleteObject",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StorageV2Server).DeleteObject(ctx, req.(*StorageV2DeleteObjectRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StorageV2_ListObjects_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StorageV2ListObjectsRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(StorageV2Server).ListObjects(m, &storageV2ListObjectsServer{stream})
}
type StorageV2_ListObjectsServer interface {
Send(*StorageV2ListObjectsResponse) error
grpc.ServerStream
}
type storageV2ListObjectsServer struct {
grpc.ServerStream
}
func (x *storageV2ListObjectsServer) Send(m *StorageV2ListObjectsResponse) error {
return x.ServerStream.SendMsg(m)
}
// StorageV2_ServiceDesc is the grpc.ServiceDesc for StorageV2 service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var StorageV2_ServiceDesc = grpc.ServiceDesc{
ServiceName: "shutdown.StorageV2",
HandlerType: (*StorageV2Server)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "HeadObject",
Handler: _StorageV2_HeadObject_Handler,
},
{
MethodName: "DeleteObject",
Handler: _StorageV2_DeleteObject_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "ReadObject",
Handler: _StorageV2_ReadObject_Handler,
ServerStreams: true,
},
{
StreamName: "WriteObject",
Handler: _StorageV2_WriteObject_Handler,
ClientStreams: true,
},
{
StreamName: "ListObjects",
Handler: _StorageV2_ListObjects_Handler,
ServerStreams: true,
},
},
Metadata: "integrations/storage/v2/definition/storage.proto",
}