Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: retire storage related functions

Steven4338234641c1
diff --git a/docs/apidocs.swagger.yaml b/docs/apidocs.swagger.yaml
index 82c17fa7c..c5ceb3351 100644
--- a/docs/apidocs.swagger.yaml
+++ b/docs/apidocs.swagger.yaml
@@ -11,7 +11,6 @@ tags:
- name: LinkService
- name: ResourceService
- name: MemoService
- - name: StorageService
- name: TagService
- name: WebhookService
- name: WorkspaceService
@@ -453,115 +452,6 @@ paths:
type: string
tags:
- ResourceService
- /api/v1/storages:
- get:
- summary: ListStorages returns a list of storages.
- operationId: StorageService_ListStorages
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1ListStoragesResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- tags:
- - StorageService
- post:
- summary: CreateStorage creates a new storage.
- operationId: StorageService_CreateStorage
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1CreateStorageResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- parameters:
- - name: body
- in: body
- required: true
- schema:
- $ref: '#/definitions/v1CreateStorageRequest'
- tags:
- - StorageService
- /api/v1/storages/{id}:
- get:
- summary: GetStorage returns a storage by id.
- operationId: StorageService_GetStorage
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1GetStorageResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- parameters:
- - name: id
- in: path
- required: true
- type: integer
- format: int32
- tags:
- - StorageService
- delete:
- summary: DeleteStorage deletes a storage by id.
- operationId: StorageService_DeleteStorage
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1DeleteStorageResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- parameters:
- - name: id
- in: path
- required: true
- type: integer
- format: int32
- tags:
- - StorageService
- /api/v1/storages/{storage.id}:
- patch:
- summary: UpdateStorage updates a storage.
- operationId: StorageService_UpdateStorage
- responses:
- "200":
- description: A successful response.
- schema:
- $ref: '#/definitions/v1UpdateStorageResponse'
- default:
- description: An unexpected error response.
- schema:
- $ref: '#/definitions/googlerpcStatus'
- parameters:
- - name: storage.id
- in: path
- required: true
- type: integer
- format: int32
- - name: storage
- in: body
- required: true
- schema:
- type: object
- properties:
- title:
- type: string
- type:
- $ref: '#/definitions/apiv1StorageType'
- config:
- $ref: '#/definitions/apiv1StorageConfig'
- tags:
- - StorageService
/api/v1/tags:
get:
summary: ListTags lists tags.
@@ -1935,50 +1825,6 @@ definitions:
type: string
fieldMapping:
$ref: '#/definitions/apiv1FieldMapping'
- apiv1S3Config:
- type: object
- properties:
- endPoint:
- type: string
- path:
- type: string
- region:
- type: string
- accessKey:
- type: string
- secretKey:
- type: string
- bucket:
- type: string
- urlPrefix:
- type: string
- urlSuffix:
- type: string
- preSign:
- type: boolean
- apiv1Storage:
- type: object
- properties:
- id:
- type: integer
- format: int32
- title:
- type: string
- type:
- $ref: '#/definitions/apiv1StorageType'
- config:
- $ref: '#/definitions/apiv1StorageConfig'
- apiv1StorageConfig:
- type: object
- properties:
- s3Config:
- $ref: '#/definitions/apiv1S3Config'
- apiv1StorageType:
- type: string
- enum:
- - TYPE_UNSPECIFIED
- - S3
- default: TYPE_UNSPECIFIED
apiv1UserSetting:
type: object
properties:
@@ -2156,16 +2002,6 @@ definitions:
type: string
visibility:
$ref: '#/definitions/v1Visibility'
- v1CreateStorageRequest:
- type: object
- properties:
- storage:
- $ref: '#/definitions/apiv1Storage'
- v1CreateStorageResponse:
- type: object
- properties:
- storage:
- $ref: '#/definitions/apiv1Storage'
v1CreateWebhookRequest:
type: object
properties:
@@ -2173,8 +2009,6 @@ definitions:
type: string
url:
type: string
- v1DeleteStorageResponse:
- type: object
v1ExportMemosRequest:
type: object
properties:
@@ -2192,11 +2026,6 @@ definitions:
properties:
linkMetadata:
$ref: '#/definitions/v1LinkMetadata'
- v1GetStorageResponse:
- type: object
- properties:
- storage:
- $ref: '#/definitions/apiv1Storage'
v1GetTagSuggestionsResponse:
type: object
properties:
@@ -2331,14 +2160,6 @@ definitions:
items:
type: object
$ref: '#/definitions/v1Resource'
- v1ListStoragesResponse:
- type: object
- properties:
- storages:
- type: array
- items:
- type: object
- $ref: '#/definitions/apiv1Storage'
v1ListTagsResponse:
type: object
properties:
@@ -2575,11 +2396,6 @@ definitions:
title: |-
The creator of tags.
Format: users/{id}
- v1UpdateStorageResponse:
- type: object
- properties:
- storage:
- $ref: '#/definitions/apiv1Storage'
v1UpsertTagRequest:
type: object
properties:
diff --git a/proto/api/v1/storage_service.proto b/proto/api/v1/storage_service.proto
deleted file mode 100644
index cde35ab48..000000000
--- a/proto/api/v1/storage_service.proto
+++ /dev/null
@@ -1,109 +0,0 @@
-syntax = "proto3";
-
-package memos.api.v1;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/protobuf/field_mask.proto";
-
-option go_package = "gen/api/v1";
-
-service StorageService {
- // CreateStorage creates a new storage.
- rpc CreateStorage(CreateStorageRequest) returns (CreateStorageResponse) {
- option (google.api.http) = {
- post: "/api/v1/storages"
- body: "*"
- };
- }
- // GetStorage returns a storage by id.
- rpc GetStorage(GetStorageRequest) returns (GetStorageResponse) {
- option (google.api.http) = {get: "/api/v1/storages/{id}"};
- option (google.api.method_signature) = "id";
- }
- // ListStorages returns a list of storages.
- rpc ListStorages(ListStoragesRequest) returns (ListStoragesResponse) {
- option (google.api.http) = {get: "/api/v1/storages"};
- }
- // UpdateStorage updates a storage.
- rpc UpdateStorage(UpdateStorageRequest) returns (UpdateStorageResponse) {
- option (google.api.http) = {
- patch: "/api/v1/storages/{storage.id}"
- body: "storage"
- };
- option (google.api.method_signature) = "storage,update_mask";
- }
- // DeleteStorage deletes a storage by id.
- rpc DeleteStorage(DeleteStorageRequest) returns (DeleteStorageResponse) {
- option (google.api.http) = {delete: "/api/v1/storages/{id}"};
- option (google.api.method_signature) = "id";
- }
-}
-
-message Storage {
- int32 id = 1;
- string title = 2;
-
- enum Type {
- TYPE_UNSPECIFIED = 0;
- S3 = 1;
- }
- Type type = 3;
- StorageConfig config = 4;
-}
-
-message StorageConfig {
- oneof config {
- S3Config s3_config = 1;
- }
-}
-
-message S3Config {
- string end_point = 1;
- string path = 2;
- string region = 3;
- string access_key = 4;
- string secret_key = 5;
- string bucket = 6;
- string url_prefix = 7;
- string url_suffix = 8;
- bool pre_sign = 9;
-}
-
-message CreateStorageRequest {
- Storage storage = 1;
-}
-
-message CreateStorageResponse {
- Storage storage = 1;
-}
-
-message GetStorageRequest {
- int32 id = 1;
-}
-
-message GetStorageResponse {
- Storage storage = 1;
-}
-
-message ListStoragesRequest {}
-
-message ListStoragesResponse {
- repeated Storage storages = 1;
-}
-
-message UpdateStorageRequest {
- Storage storage = 1;
-
- google.protobuf.FieldMask update_mask = 2;
-}
-
-message UpdateStorageResponse {
- Storage storage = 1;
-}
-
-message DeleteStorageRequest {
- int32 id = 1;
-}
-
-message DeleteStorageResponse {}
diff --git a/proto/gen/api/v1/storage_service.pb.go b/proto/gen/api/v1/storage_service.pb.go
deleted file mode 100644
index b2cea12e6..000000000
--- a/proto/gen/api/v1/storage_service.pb.go
+++ /dev/null
@@ -1,1163 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.33.0
-// protoc (unknown)
-// source: api/v1/storage_service.proto
-
-package apiv1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
- reflect "reflect"
- sync "sync"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type Storage_Type int32
-
-const (
- Storage_TYPE_UNSPECIFIED Storage_Type = 0
- Storage_S3 Storage_Type = 1
-)
-
-// Enum value maps for Storage_Type.
-var (
- Storage_Type_name = map[int32]string{
- 0: "TYPE_UNSPECIFIED",
- 1: "S3",
- }
- Storage_Type_value = map[string]int32{
- "TYPE_UNSPECIFIED": 0,
- "S3": 1,
- }
-)
-
-func (x Storage_Type) Enum() *Storage_Type {
- p := new(Storage_Type)
- *p = x
- return p
-}
-
-func (x Storage_Type) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Storage_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_api_v1_storage_service_proto_enumTypes[0].Descriptor()
-}
-
-func (Storage_Type) Type() protoreflect.EnumType {
- return &file_api_v1_storage_service_proto_enumTypes[0]
-}
-
-func (x Storage_Type) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Storage_Type.Descriptor instead.
-func (Storage_Type) EnumDescriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{0, 0}
-}
-
-type Storage struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
- Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
- Type Storage_Type `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v1.Storage_Type" json:"type,omitempty"`
- Config *StorageConfig `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"`
-}
-
-func (x *Storage) Reset() {
- *x = Storage{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Storage) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Storage) ProtoMessage() {}
-
-func (x *Storage) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Storage.ProtoReflect.Descriptor instead.
-func (*Storage) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Storage) GetId() int32 {
- if x != nil {
- return x.Id
- }
- return 0
-}
-
-func (x *Storage) GetTitle() string {
- if x != nil {
- return x.Title
- }
- return ""
-}
-
-func (x *Storage) GetType() Storage_Type {
- if x != nil {
- return x.Type
- }
- return Storage_TYPE_UNSPECIFIED
-}
-
-func (x *Storage) GetConfig() *StorageConfig {
- if x != nil {
- return x.Config
- }
- return nil
-}
-
-type StorageConfig struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Types that are assignable to Config:
- //
- // *StorageConfig_S3Config
- Config isStorageConfig_Config `protobuf_oneof:"config"`
-}
-
-func (x *StorageConfig) Reset() {
- *x = StorageConfig{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *StorageConfig) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*StorageConfig) ProtoMessage() {}
-
-func (x *StorageConfig) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use StorageConfig.ProtoReflect.Descriptor instead.
-func (*StorageConfig) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (m *StorageConfig) GetConfig() isStorageConfig_Config {
- if m != nil {
- return m.Config
- }
- return nil
-}
-
-func (x *StorageConfig) GetS3Config() *S3Config {
- if x, ok := x.GetConfig().(*StorageConfig_S3Config); ok {
- return x.S3Config
- }
- return nil
-}
-
-type isStorageConfig_Config interface {
- isStorageConfig_Config()
-}
-
-type StorageConfig_S3Config struct {
- S3Config *S3Config `protobuf:"bytes,1,opt,name=s3_config,json=s3Config,proto3,oneof"`
-}
-
-func (*StorageConfig_S3Config) isStorageConfig_Config() {}
-
-type S3Config struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- EndPoint string `protobuf:"bytes,1,opt,name=end_point,json=endPoint,proto3" json:"end_point,omitempty"`
- Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
- Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`
- AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"`
- SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
- Bucket string `protobuf:"bytes,6,opt,name=bucket,proto3" json:"bucket,omitempty"`
- UrlPrefix string `protobuf:"bytes,7,opt,name=url_prefix,json=urlPrefix,proto3" json:"url_prefix,omitempty"`
- UrlSuffix string `protobuf:"bytes,8,opt,name=url_suffix,json=urlSuffix,proto3" json:"url_suffix,omitempty"`
- PreSign bool `protobuf:"varint,9,opt,name=pre_sign,json=preSign,proto3" json:"pre_sign,omitempty"`
-}
-
-func (x *S3Config) Reset() {
- *x = S3Config{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *S3Config) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*S3Config) ProtoMessage() {}
-
-func (x *S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use S3Config.ProtoReflect.Descriptor instead.
-func (*S3Config) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *S3Config) GetEndPoint() string {
- if x != nil {
- return x.EndPoint
- }
- return ""
-}
-
-func (x *S3Config) GetPath() string {
- if x != nil {
- return x.Path
- }
- return ""
-}
-
-func (x *S3Config) GetRegion() string {
- if x != nil {
- return x.Region
- }
- return ""
-}
-
-func (x *S3Config) GetAccessKey() string {
- if x != nil {
- return x.AccessKey
- }
- return ""
-}
-
-func (x *S3Config) GetSecretKey() string {
- if x != nil {
- return x.SecretKey
- }
- return ""
-}
-
-func (x *S3Config) GetBucket() string {
- if x != nil {
- return x.Bucket
- }
- return ""
-}
-
-func (x *S3Config) GetUrlPrefix() string {
- if x != nil {
- return x.UrlPrefix
- }
- return ""
-}
-
-func (x *S3Config) GetUrlSuffix() string {
- if x != nil {
- return x.UrlSuffix
- }
- return ""
-}
-
-func (x *S3Config) GetPreSign() bool {
- if x != nil {
- return x.PreSign
- }
- return false
-}
-
-type CreateStorageRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storage *Storage `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
-}
-
-func (x *CreateStorageRequest) Reset() {
- *x = CreateStorageRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CreateStorageRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateStorageRequest) ProtoMessage() {}
-
-func (x *CreateStorageRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CreateStorageRequest.ProtoReflect.Descriptor instead.
-func (*CreateStorageRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *CreateStorageRequest) GetStorage() *Storage {
- if x != nil {
- return x.Storage
- }
- return nil
-}
-
-type CreateStorageResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storage *Storage `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
-}
-
-func (x *CreateStorageResponse) Reset() {
- *x = CreateStorageResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CreateStorageResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateStorageResponse) ProtoMessage() {}
-
-func (x *CreateStorageResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CreateStorageResponse.ProtoReflect.Descriptor instead.
-func (*CreateStorageResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *CreateStorageResponse) GetStorage() *Storage {
- if x != nil {
- return x.Storage
- }
- return nil
-}
-
-type GetStorageRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
-}
-
-func (x *GetStorageRequest) Reset() {
- *x = GetStorageRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GetStorageRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetStorageRequest) ProtoMessage() {}
-
-func (x *GetStorageRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GetStorageRequest.ProtoReflect.Descriptor instead.
-func (*GetStorageRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *GetStorageRequest) GetId() int32 {
- if x != nil {
- return x.Id
- }
- return 0
-}
-
-type GetStorageResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storage *Storage `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
-}
-
-func (x *GetStorageResponse) Reset() {
- *x = GetStorageResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GetStorageResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetStorageResponse) ProtoMessage() {}
-
-func (x *GetStorageResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GetStorageResponse.ProtoReflect.Descriptor instead.
-func (*GetStorageResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *GetStorageResponse) GetStorage() *Storage {
- if x != nil {
- return x.Storage
- }
- return nil
-}
-
-type ListStoragesRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-}
-
-func (x *ListStoragesRequest) Reset() {
- *x = ListStoragesRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ListStoragesRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListStoragesRequest) ProtoMessage() {}
-
-func (x *ListStoragesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListStoragesRequest.ProtoReflect.Descriptor instead.
-func (*ListStoragesRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{7}
-}
-
-type ListStoragesResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storages []*Storage `protobuf:"bytes,1,rep,name=storages,proto3" json:"storages,omitempty"`
-}
-
-func (x *ListStoragesResponse) Reset() {
- *x = ListStoragesResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ListStoragesResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListStoragesResponse) ProtoMessage() {}
-
-func (x *ListStoragesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[8]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListStoragesResponse.ProtoReflect.Descriptor instead.
-func (*ListStoragesResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{8}
-}
-
-func (x *ListStoragesResponse) GetStorages() []*Storage {
- if x != nil {
- return x.Storages
- }
- return nil
-}
-
-type UpdateStorageRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storage *Storage `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
-}
-
-func (x *UpdateStorageRequest) Reset() {
- *x = UpdateStorageRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *UpdateStorageRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateStorageRequest) ProtoMessage() {}
-
-func (x *UpdateStorageRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[9]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateStorageRequest.ProtoReflect.Descriptor instead.
-func (*UpdateStorageRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *UpdateStorageRequest) GetStorage() *Storage {
- if x != nil {
- return x.Storage
- }
- return nil
-}
-
-func (x *UpdateStorageRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-type UpdateStorageResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Storage *Storage `protobuf:"bytes,1,opt,name=storage,proto3" json:"storage,omitempty"`
-}
-
-func (x *UpdateStorageResponse) Reset() {
- *x = UpdateStorageResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *UpdateStorageResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateStorageResponse) ProtoMessage() {}
-
-func (x *UpdateStorageResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[10]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateStorageResponse.ProtoReflect.Descriptor instead.
-func (*UpdateStorageResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{10}
-}
-
-func (x *UpdateStorageResponse) GetStorage() *Storage {
- if x != nil {
- return x.Storage
- }
- return nil
-}
-
-type DeleteStorageRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
-}
-
-func (x *DeleteStorageRequest) Reset() {
- *x = DeleteStorageRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *DeleteStorageRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteStorageRequest) ProtoMessage() {}
-
-func (x *DeleteStorageRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[11]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use DeleteStorageRequest.ProtoReflect.Descriptor instead.
-func (*DeleteStorageRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{11}
-}
-
-func (x *DeleteStorageRequest) GetId() int32 {
- if x != nil {
- return x.Id
- }
- return 0
-}
-
-type DeleteStorageResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-}
-
-func (x *DeleteStorageResponse) Reset() {
- *x = DeleteStorageResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_storage_service_proto_msgTypes[12]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *DeleteStorageResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteStorageResponse) ProtoMessage() {}
-
-func (x *DeleteStorageResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_storage_service_proto_msgTypes[12]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use DeleteStorageResponse.ProtoReflect.Descriptor instead.
-func (*DeleteStorageResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_storage_service_proto_rawDescGZIP(), []int{12}
-}
-
-var File_api_v1_storage_service_proto protoreflect.FileDescriptor
-
-var file_api_v1_storage_service_proto_rawDesc = []byte{
- 0x0a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
- 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c,
- 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
- 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
- 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69,
- 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
- 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
- 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70,
- 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69,
- 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x24, 0x0a, 0x04,
- 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53,
- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33,
- 0x10, 0x01, 0x22, 0x50, 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e,
- 0x66, 0x69, 0x67, 0x12, 0x35, 0x0a, 0x09, 0x73, 0x33, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
- 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00,
- 0x52, 0x08, 0x73, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x22, 0x82, 0x02, 0x0a, 0x08, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69,
- 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x12,
- 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61,
- 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63,
- 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
- 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63,
- 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
- 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b,
- 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74,
- 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x07,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12,
- 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x08, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x19,
- 0x0a, 0x08, 0x70, 0x72, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x07, 0x70, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x22, 0x47, 0x0a, 0x14, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
- 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61,
- 0x67, 0x65, 0x22, 0x48, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72,
- 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x73,
- 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d,
- 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72,
- 0x61, 0x67, 0x65, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x11,
- 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69,
- 0x64, 0x22, 0x45, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61,
- 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73,
- 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52,
- 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74,
- 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
- 0x49, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61,
- 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,
- 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
- 0x52, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x55,
- 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x07, 0x73, 0x74, 0x6f,
- 0x72, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d,
- 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c,
- 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73,
- 0x6b, 0x22, 0x48, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61,
- 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x73, 0x74,
- 0x6f, 0x72, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65,
- 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61,
- 0x67, 0x65, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x22, 0x26, 0x0a, 0x14, 0x44,
- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x02, 0x69, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f,
- 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8c, 0x05, 0x0a,
- 0x0e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
- 0x75, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
- 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
- 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
- 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02,
- 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74,
- 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x73, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f,
- 0x72, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
- 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74,
- 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x4c,
- 0x69, 0x73, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x6d, 0x65,
- 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53,
- 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22,
- 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69,
- 0x73, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x61, 0x70, 0x69,
- 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x12, 0x9e, 0x01, 0x0a,
- 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x22,
- 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70,
- 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
- 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0xda, 0x41, 0x13, 0x73, 0x74, 0x6f, 0x72,
- 0x61, 0x67, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82,
- 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x32, 0x1d,
- 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73,
- 0x2f, 0x7b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x7c, 0x0a,
- 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x22,
- 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65,
- 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
- 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74,
- 0x6f, 0x72, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0xab, 0x01, 0x0a, 0x10,
- 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31,
- 0x42, 0x13, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
- 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d,
- 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69,
- 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa,
- 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02,
- 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18,
- 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
- 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73,
- 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x33,
-}
-
-var (
- file_api_v1_storage_service_proto_rawDescOnce sync.Once
- file_api_v1_storage_service_proto_rawDescData = file_api_v1_storage_service_proto_rawDesc
-)
-
-func file_api_v1_storage_service_proto_rawDescGZIP() []byte {
- file_api_v1_storage_service_proto_rawDescOnce.Do(func() {
- file_api_v1_storage_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v1_storage_service_proto_rawDescData)
- })
- return file_api_v1_storage_service_proto_rawDescData
-}
-
-var file_api_v1_storage_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_api_v1_storage_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
-var file_api_v1_storage_service_proto_goTypes = []interface{}{
- (Storage_Type)(0), // 0: memos.api.v1.Storage.Type
- (*Storage)(nil), // 1: memos.api.v1.Storage
- (*StorageConfig)(nil), // 2: memos.api.v1.StorageConfig
- (*S3Config)(nil), // 3: memos.api.v1.S3Config
- (*CreateStorageRequest)(nil), // 4: memos.api.v1.CreateStorageRequest
- (*CreateStorageResponse)(nil), // 5: memos.api.v1.CreateStorageResponse
- (*GetStorageRequest)(nil), // 6: memos.api.v1.GetStorageRequest
- (*GetStorageResponse)(nil), // 7: memos.api.v1.GetStorageResponse
- (*ListStoragesRequest)(nil), // 8: memos.api.v1.ListStoragesRequest
- (*ListStoragesResponse)(nil), // 9: memos.api.v1.ListStoragesResponse
- (*UpdateStorageRequest)(nil), // 10: memos.api.v1.UpdateStorageRequest
- (*UpdateStorageResponse)(nil), // 11: memos.api.v1.UpdateStorageResponse
- (*DeleteStorageRequest)(nil), // 12: memos.api.v1.DeleteStorageRequest
- (*DeleteStorageResponse)(nil), // 13: memos.api.v1.DeleteStorageResponse
- (*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask
-}
-var file_api_v1_storage_service_proto_depIdxs = []int32{
- 0, // 0: memos.api.v1.Storage.type:type_name -> memos.api.v1.Storage.Type
- 2, // 1: memos.api.v1.Storage.config:type_name -> memos.api.v1.StorageConfig
- 3, // 2: memos.api.v1.StorageConfig.s3_config:type_name -> memos.api.v1.S3Config
- 1, // 3: memos.api.v1.CreateStorageRequest.storage:type_name -> memos.api.v1.Storage
- 1, // 4: memos.api.v1.CreateStorageResponse.storage:type_name -> memos.api.v1.Storage
- 1, // 5: memos.api.v1.GetStorageResponse.storage:type_name -> memos.api.v1.Storage
- 1, // 6: memos.api.v1.ListStoragesResponse.storages:type_name -> memos.api.v1.Storage
- 1, // 7: memos.api.v1.UpdateStorageRequest.storage:type_name -> memos.api.v1.Storage
- 14, // 8: memos.api.v1.UpdateStorageRequest.update_mask:type_name -> google.protobuf.FieldMask
- 1, // 9: memos.api.v1.UpdateStorageResponse.storage:type_name -> memos.api.v1.Storage
- 4, // 10: memos.api.v1.StorageService.CreateStorage:input_type -> memos.api.v1.CreateStorageRequest
- 6, // 11: memos.api.v1.StorageService.GetStorage:input_type -> memos.api.v1.GetStorageRequest
- 8, // 12: memos.api.v1.StorageService.ListStorages:input_type -> memos.api.v1.ListStoragesRequest
- 10, // 13: memos.api.v1.StorageService.UpdateStorage:input_type -> memos.api.v1.UpdateStorageRequest
- 12, // 14: memos.api.v1.StorageService.DeleteStorage:input_type -> memos.api.v1.DeleteStorageRequest
- 5, // 15: memos.api.v1.StorageService.CreateStorage:output_type -> memos.api.v1.CreateStorageResponse
- 7, // 16: memos.api.v1.StorageService.GetStorage:output_type -> memos.api.v1.GetStorageResponse
- 9, // 17: memos.api.v1.StorageService.ListStorages:output_type -> memos.api.v1.ListStoragesResponse
- 11, // 18: memos.api.v1.StorageService.UpdateStorage:output_type -> memos.api.v1.UpdateStorageResponse
- 13, // 19: memos.api.v1.StorageService.DeleteStorage:output_type -> memos.api.v1.DeleteStorageResponse
- 15, // [15:20] is the sub-list for method output_type
- 10, // [10:15] is the sub-list for method input_type
- 10, // [10:10] is the sub-list for extension type_name
- 10, // [10:10] is the sub-list for extension extendee
- 0, // [0:10] is the sub-list for field type_name
-}
-
-func init() { file_api_v1_storage_service_proto_init() }
-func file_api_v1_storage_service_proto_init() {
- if File_api_v1_storage_service_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_api_v1_storage_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Storage); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*StorageConfig); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*S3Config); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CreateStorageRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CreateStorageResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetStorageRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetStorageResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ListStoragesRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ListStoragesResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*UpdateStorageRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*UpdateStorageResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteStorageRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_api_v1_storage_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteStorageResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- file_api_v1_storage_service_proto_msgTypes[1].OneofWrappers = []interface{}{
- (*StorageConfig_S3Config)(nil),
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_api_v1_storage_service_proto_rawDesc,
- NumEnums: 1,
- NumMessages: 13,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_api_v1_storage_service_proto_goTypes,
- DependencyIndexes: file_api_v1_storage_service_proto_depIdxs,
- EnumInfos: file_api_v1_storage_service_proto_enumTypes,
- MessageInfos: file_api_v1_storage_service_proto_msgTypes,
- }.Build()
- File_api_v1_storage_service_proto = out.File
- file_api_v1_storage_service_proto_rawDesc = nil
- file_api_v1_storage_service_proto_goTypes = nil
- file_api_v1_storage_service_proto_depIdxs = nil
-}
diff --git a/proto/gen/api/v1/storage_service.pb.gw.go b/proto/gen/api/v1/storage_service.pb.gw.go
deleted file mode 100644
index f5c5de133..000000000
--- a/proto/gen/api/v1/storage_service.pb.gw.go
+++ /dev/null
@@ -1,589 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: api/v1/storage_service.proto
-
-/*
-Package apiv1 is a reverse proxy.
-
-It translates gRPC into RESTful JSON APIs.
-*/
-package apiv1
-
-import (
- "context"
- "io"
- "net/http"
-
- "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
- "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/proto"
-)
-
-// Suppress "imported and not used" errors
-var _ codes.Code
-var _ io.Reader
-var _ status.Status
-var _ = runtime.String
-var _ = utilities.NewDoubleArray
-var _ = metadata.Join
-
-func request_StorageService_CreateStorage_0(ctx context.Context, marshaler runtime.Marshaler, client StorageServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq CreateStorageRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.CreateStorage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_StorageService_CreateStorage_0(ctx context.Context, marshaler runtime.Marshaler, server StorageServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq CreateStorageRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.CreateStorage(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-func request_StorageService_GetStorage_0(ctx context.Context, marshaler runtime.Marshaler, client StorageServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq GetStorageRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
-
- protoReq.Id, err = runtime.Int32(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
-
- msg, err := client.GetStorage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_StorageService_GetStorage_0(ctx context.Context, marshaler runtime.Marshaler, server StorageServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq GetStorageRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
-
- protoReq.Id, err = runtime.Int32(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
-
- msg, err := server.GetStorage(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-func request_StorageService_ListStorages_0(ctx context.Context, marshaler runtime.Marshaler, client StorageServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListStoragesRequest
- var metadata runtime.ServerMetadata
-
- msg, err := client.ListStorages(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_StorageService_ListStorages_0(ctx context.Context, marshaler runtime.Marshaler, server StorageServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq ListStoragesRequest
- var metadata runtime.ServerMetadata
-
- msg, err := server.ListStorages(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-var (
- filter_StorageService_UpdateStorage_0 = &utilities.DoubleArray{Encoding: map[string]int{"storage": 0, "id": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-)
-
-func request_StorageService_UpdateStorage_0(ctx context.Context, marshaler runtime.Marshaler, client StorageServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq UpdateStorageRequest
- var metadata runtime.ServerMetadata
-
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Storage); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Storage); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["storage.id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "storage.id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "storage.id", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "storage.id", err)
- }
-
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_StorageService_UpdateStorage_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UpdateStorage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_StorageService_UpdateStorage_0(ctx context.Context, marshaler runtime.Marshaler, server StorageServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq UpdateStorageRequest
- var metadata runtime.ServerMetadata
-
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Storage); err != nil && err != io.EOF {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Storage); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["storage.id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "storage.id")
- }
-
- err = runtime.PopulateFieldFromPath(&protoReq, "storage.id", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "storage.id", err)
- }
-
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_StorageService_UpdateStorage_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := server.UpdateStorage(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-func request_StorageService_DeleteStorage_0(ctx context.Context, marshaler runtime.Marshaler, client StorageServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DeleteStorageRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
-
- protoReq.Id, err = runtime.Int32(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
-
- msg, err := client.DeleteStorage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_StorageService_DeleteStorage_0(ctx context.Context, marshaler runtime.Marshaler, server StorageServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DeleteStorageRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
-
- protoReq.Id, err = runtime.Int32(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
-
- msg, err := server.DeleteStorage(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-// RegisterStorageServiceHandlerServer registers the http handlers for service StorageService to "mux".
-// UnaryRPC :call StorageServiceServer directly.
-// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterStorageServiceHandlerFromEndpoint instead.
-func RegisterStorageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StorageServiceServer) error {
-
- mux.Handle("POST", pattern_StorageService_CreateStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.StorageService/CreateStorage", runtime.WithHTTPPathPattern("/api/v1/storages"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_StorageService_CreateStorage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_CreateStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_StorageService_GetStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.StorageService/GetStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_StorageService_GetStorage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_GetStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_StorageService_ListStorages_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.StorageService/ListStorages", runtime.WithHTTPPathPattern("/api/v1/storages"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_StorageService_ListStorages_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_ListStorages_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("PATCH", pattern_StorageService_UpdateStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.StorageService/UpdateStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{storage.id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_StorageService_UpdateStorage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_UpdateStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_StorageService_DeleteStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.StorageService/DeleteStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_StorageService_DeleteStorage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_DeleteStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-// RegisterStorageServiceHandlerFromEndpoint is same as RegisterStorageServiceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterStorageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.DialContext(ctx, endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterStorageServiceHandler(ctx, mux, conn)
-}
-
-// RegisterStorageServiceHandler registers the http handlers for service StorageService to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterStorageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterStorageServiceHandlerClient(ctx, mux, NewStorageServiceClient(conn))
-}
-
-// RegisterStorageServiceHandlerClient registers the http handlers for service StorageService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StorageServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StorageServiceClient"
-// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "StorageServiceClient" to call the correct interceptors.
-func RegisterStorageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StorageServiceClient) error {
-
- mux.Handle("POST", pattern_StorageService_CreateStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.StorageService/CreateStorage", runtime.WithHTTPPathPattern("/api/v1/storages"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_StorageService_CreateStorage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_CreateStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_StorageService_GetStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.StorageService/GetStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_StorageService_GetStorage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_GetStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_StorageService_ListStorages_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.StorageService/ListStorages", runtime.WithHTTPPathPattern("/api/v1/storages"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_StorageService_ListStorages_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_ListStorages_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("PATCH", pattern_StorageService_UpdateStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.StorageService/UpdateStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{storage.id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_StorageService_UpdateStorage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_UpdateStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("DELETE", pattern_StorageService_DeleteStorage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- var err error
- var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.StorageService/DeleteStorage", runtime.WithHTTPPathPattern("/api/v1/storages/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_StorageService_DeleteStorage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_StorageService_DeleteStorage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_StorageService_CreateStorage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "storages"}, ""))
-
- pattern_StorageService_GetStorage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "storages", "id"}, ""))
-
- pattern_StorageService_ListStorages_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "storages"}, ""))
-
- pattern_StorageService_UpdateStorage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "storages", "storage.id"}, ""))
-
- pattern_StorageService_DeleteStorage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "storages", "id"}, ""))
-)
-
-var (
- forward_StorageService_CreateStorage_0 = runtime.ForwardResponseMessage
-
- forward_StorageService_GetStorage_0 = runtime.ForwardResponseMessage
-
- forward_StorageService_ListStorages_0 = runtime.ForwardResponseMessage
-
- forward_StorageService_UpdateStorage_0 = runtime.ForwardResponseMessage
-
- forward_StorageService_DeleteStorage_0 = runtime.ForwardResponseMessage
-)
diff --git a/proto/gen/api/v1/storage_service_grpc.pb.go b/proto/gen/api/v1/storage_service_grpc.pb.go
deleted file mode 100644
index 2a7ea651d..000000000
--- a/proto/gen/api/v1/storage_service_grpc.pb.go
+++ /dev/null
@@ -1,267 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.3.0
-// - protoc (unknown)
-// source: api/v1/storage_service.proto
-
-package apiv1
-
-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
-
-const (
- StorageService_CreateStorage_FullMethodName = "/memos.api.v1.StorageService/CreateStorage"
- StorageService_GetStorage_FullMethodName = "/memos.api.v1.StorageService/GetStorage"
- StorageService_ListStorages_FullMethodName = "/memos.api.v1.StorageService/ListStorages"
- StorageService_UpdateStorage_FullMethodName = "/memos.api.v1.StorageService/UpdateStorage"
- StorageService_DeleteStorage_FullMethodName = "/memos.api.v1.StorageService/DeleteStorage"
-)
-
-// StorageServiceClient is the client API for StorageService 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 StorageServiceClient interface {
- // CreateStorage creates a new storage.
- CreateStorage(ctx context.Context, in *CreateStorageRequest, opts ...grpc.CallOption) (*CreateStorageResponse, error)
- // GetStorage returns a storage by id.
- GetStorage(ctx context.Context, in *GetStorageRequest, opts ...grpc.CallOption) (*GetStorageResponse, error)
- // ListStorages returns a list of storages.
- ListStorages(ctx context.Context, in *ListStoragesRequest, opts ...grpc.CallOption) (*ListStoragesResponse, error)
- // UpdateStorage updates a storage.
- UpdateStorage(ctx context.Context, in *UpdateStorageRequest, opts ...grpc.CallOption) (*UpdateStorageResponse, error)
- // DeleteStorage deletes a storage by id.
- DeleteStorage(ctx context.Context, in *DeleteStorageRequest, opts ...grpc.CallOption) (*DeleteStorageResponse, error)
-}
-
-type storageServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewStorageServiceClient(cc grpc.ClientConnInterface) StorageServiceClient {
- return &storageServiceClient{cc}
-}
-
-func (c *storageServiceClient) CreateStorage(ctx context.Context, in *CreateStorageRequest, opts ...grpc.CallOption) (*CreateStorageResponse, error) {
- out := new(CreateStorageResponse)
- err := c.cc.Invoke(ctx, StorageService_CreateStorage_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *storageServiceClient) GetStorage(ctx context.Context, in *GetStorageRequest, opts ...grpc.CallOption) (*GetStorageResponse, error) {
- out := new(GetStorageResponse)
- err := c.cc.Invoke(ctx, StorageService_GetStorage_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *storageServiceClient) ListStorages(ctx context.Context, in *ListStoragesRequest, opts ...grpc.CallOption) (*ListStoragesResponse, error) {
- out := new(ListStoragesResponse)
- err := c.cc.Invoke(ctx, StorageService_ListStorages_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *storageServiceClient) UpdateStorage(ctx context.Context, in *UpdateStorageRequest, opts ...grpc.CallOption) (*UpdateStorageResponse, error) {
- out := new(UpdateStorageResponse)
- err := c.cc.Invoke(ctx, StorageService_UpdateStorage_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *storageServiceClient) DeleteStorage(ctx context.Context, in *DeleteStorageRequest, opts ...grpc.CallOption) (*DeleteStorageResponse, error) {
- out := new(DeleteStorageResponse)
- err := c.cc.Invoke(ctx, StorageService_DeleteStorage_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// StorageServiceServer is the server API for StorageService service.
-// All implementations must embed UnimplementedStorageServiceServer
-// for forward compatibility
-type StorageServiceServer interface {
- // CreateStorage creates a new storage.
- CreateStorage(context.Context, *CreateStorageRequest) (*CreateStorageResponse, error)
- // GetStorage returns a storage by id.
- GetStorage(context.Context, *GetStorageRequest) (*GetStorageResponse, error)
- // ListStorages returns a list of storages.
- ListStorages(context.Context, *ListStoragesRequest) (*ListStoragesResponse, error)
- // UpdateStorage updates a storage.
- UpdateStorage(context.Context, *UpdateStorageRequest) (*UpdateStorageResponse, error)
- // DeleteStorage deletes a storage by id.
- DeleteStorage(context.Context, *DeleteStorageRequest) (*DeleteStorageResponse, error)
- mustEmbedUnimplementedStorageServiceServer()
-}
-
-// UnimplementedStorageServiceServer must be embedded to have forward compatible implementations.
-type UnimplementedStorageServiceServer struct {
-}
-
-func (UnimplementedStorageServiceServer) CreateStorage(context.Context, *CreateStorageRequest) (*CreateStorageResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method CreateStorage not implemented")
-}
-func (UnimplementedStorageServiceServer) GetStorage(context.Context, *GetStorageRequest) (*GetStorageResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetStorage not implemented")
-}
-func (UnimplementedStorageServiceServer) ListStorages(context.Context, *ListStoragesRequest) (*ListStoragesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListStorages not implemented")
-}
-func (UnimplementedStorageServiceServer) UpdateStorage(context.Context, *UpdateStorageRequest) (*UpdateStorageResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateStorage not implemented")
-}
-func (UnimplementedStorageServiceServer) DeleteStorage(context.Context, *DeleteStorageRequest) (*DeleteStorageResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteStorage not implemented")
-}
-func (UnimplementedStorageServiceServer) mustEmbedUnimplementedStorageServiceServer() {}
-
-// UnsafeStorageServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to StorageServiceServer will
-// result in compilation errors.
-type UnsafeStorageServiceServer interface {
- mustEmbedUnimplementedStorageServiceServer()
-}
-
-func RegisterStorageServiceServer(s grpc.ServiceRegistrar, srv StorageServiceServer) {
- s.RegisterService(&StorageService_ServiceDesc, srv)
-}
-
-func _StorageService_CreateStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateStorageRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(StorageServiceServer).CreateStorage(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: StorageService_CreateStorage_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(StorageServiceServer).CreateStorage(ctx, req.(*CreateStorageRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _StorageService_GetStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetStorageRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(StorageServiceServer).GetStorage(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: StorageService_GetStorage_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(StorageServiceServer).GetStorage(ctx, req.(*GetStorageRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _StorageService_ListStorages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListStoragesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(StorageServiceServer).ListStorages(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: StorageService_ListStorages_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(StorageServiceServer).ListStorages(ctx, req.(*ListStoragesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _StorageService_UpdateStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateStorageRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(StorageServiceServer).UpdateStorage(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: StorageService_UpdateStorage_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(StorageServiceServer).UpdateStorage(ctx, req.(*UpdateStorageRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _StorageService_DeleteStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteStorageRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(StorageServiceServer).DeleteStorage(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: StorageService_DeleteStorage_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(StorageServiceServer).DeleteStorage(ctx, req.(*DeleteStorageRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// StorageService_ServiceDesc is the grpc.ServiceDesc for StorageService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var StorageService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "memos.api.v1.StorageService",
- HandlerType: (*StorageServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "CreateStorage",
- Handler: _StorageService_CreateStorage_Handler,
- },
- {
- MethodName: "GetStorage",
- Handler: _StorageService_GetStorage_Handler,
- },
- {
- MethodName: "ListStorages",
- Handler: _StorageService_ListStorages_Handler,
- },
- {
- MethodName: "UpdateStorage",
- Handler: _StorageService_UpdateStorage_Handler,
- },
- {
- MethodName: "DeleteStorage",
- Handler: _StorageService_DeleteStorage_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "api/v1/storage_service.proto",
-}
diff --git a/proto/gen/store/storage.pb.go b/proto/gen/store/storage.pb.go
deleted file mode 100644
index 1d4475b8d..000000000
--- a/proto/gen/store/storage.pb.go
+++ /dev/null
@@ -1,465 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.33.0
-// protoc (unknown)
-// source: store/storage.proto
-
-package store
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- reflect "reflect"
- sync "sync"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type Storage_Type int32
-
-const (
- Storage_TYPE_UNSPECIFIED Storage_Type = 0
- Storage_S3 Storage_Type = 1
-)
-
-// Enum value maps for Storage_Type.
-var (
- Storage_Type_name = map[int32]string{
- 0: "TYPE_UNSPECIFIED",
- 1: "S3",
- }
- Storage_Type_value = map[string]int32{
- "TYPE_UNSPECIFIED": 0,
- "S3": 1,
- }
-)
-
-func (x Storage_Type) Enum() *Storage_Type {
- p := new(Storage_Type)
- *p = x
- return p
-}
-
-func (x Storage_Type) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Storage_Type) Descriptor() protoreflect.EnumDescriptor {
- return file_store_storage_proto_enumTypes[0].Descriptor()
-}
-
-func (Storage_Type) Type() protoreflect.EnumType {
- return &file_store_storage_proto_enumTypes[0]
-}
-
-func (x Storage_Type) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use Storage_Type.Descriptor instead.
-func (Storage_Type) EnumDescriptor() ([]byte, []int) {
- return file_store_storage_proto_rawDescGZIP(), []int{0, 0}
-}
-
-type Storage struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
- Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
- Type Storage_Type `protobuf:"varint,3,opt,name=type,proto3,enum=memos.store.Storage_Type" json:"type,omitempty"`
- Config *StorageConfig `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"`
-}
-
-func (x *Storage) Reset() {
- *x = Storage{}
- if protoimpl.UnsafeEnabled {
- mi := &file_store_storage_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Storage) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Storage) ProtoMessage() {}
-
-func (x *Storage) ProtoReflect() protoreflect.Message {
- mi := &file_store_storage_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Storage.ProtoReflect.Descriptor instead.
-func (*Storage) Descriptor() ([]byte, []int) {
- return file_store_storage_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Storage) GetId() int32 {
- if x != nil {
- return x.Id
- }
- return 0
-}
-
-func (x *Storage) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *Storage) GetType() Storage_Type {
- if x != nil {
- return x.Type
- }
- return Storage_TYPE_UNSPECIFIED
-}
-
-func (x *Storage) GetConfig() *StorageConfig {
- if x != nil {
- return x.Config
- }
- return nil
-}
-
-type StorageConfig struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Types that are assignable to StorageConfig:
- //
- // *StorageConfig_S3Config
- StorageConfig isStorageConfig_StorageConfig `protobuf_oneof:"storage_config"`
-}
-
-func (x *StorageConfig) Reset() {
- *x = StorageConfig{}
- if protoimpl.UnsafeEnabled {
- mi := &file_store_storage_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *StorageConfig) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*StorageConfig) ProtoMessage() {}
-
-func (x *StorageConfig) ProtoReflect() protoreflect.Message {
- mi := &file_store_storage_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use StorageConfig.ProtoReflect.Descriptor instead.
-func (*StorageConfig) Descriptor() ([]byte, []int) {
- return file_store_storage_proto_rawDescGZIP(), []int{1}
-}
-
-func (m *StorageConfig) GetStorageConfig() isStorageConfig_StorageConfig {
- if m != nil {
- return m.StorageConfig
- }
- return nil
-}
-
-func (x *StorageConfig) GetS3Config() *S3Config {
- if x, ok := x.GetStorageConfig().(*StorageConfig_S3Config); ok {
- return x.S3Config
- }
- return nil
-}
-
-type isStorageConfig_StorageConfig interface {
- isStorageConfig_StorageConfig()
-}
-
-type StorageConfig_S3Config struct {
- S3Config *S3Config `protobuf:"bytes,1,opt,name=s3_config,json=s3Config,proto3,oneof"`
-}
-
-func (*StorageConfig_S3Config) isStorageConfig_StorageConfig() {}
-
-type S3Config struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- EndPoint string `protobuf:"bytes,1,opt,name=end_point,json=endPoint,proto3" json:"end_point,omitempty"`
- Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
- Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`
- AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"`
- SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
- Bucket string `protobuf:"bytes,6,opt,name=bucket,proto3" json:"bucket,omitempty"`
- UrlPrefix string `protobuf:"bytes,7,opt,name=url_prefix,json=urlPrefix,proto3" json:"url_prefix,omitempty"`
- UrlSuffix string `protobuf:"bytes,8,opt,name=url_suffix,json=urlSuffix,proto3" json:"url_suffix,omitempty"`
- PreSign bool `protobuf:"varint,9,opt,name=pre_sign,json=preSign,proto3" json:"pre_sign,omitempty"`
-}
-
-func (x *S3Config) Reset() {
- *x = S3Config{}
- if protoimpl.UnsafeEnabled {
- mi := &file_store_storage_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *S3Config) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*S3Config) ProtoMessage() {}
-
-func (x *S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_store_storage_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use S3Config.ProtoReflect.Descriptor instead.
-func (*S3Config) Descriptor() ([]byte, []int) {
- return file_store_storage_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *S3Config) GetEndPoint() string {
- if x != nil {
- return x.EndPoint
- }
- return ""
-}
-
-func (x *S3Config) GetPath() string {
- if x != nil {
- return x.Path
- }
- return ""
-}
-
-func (x *S3Config) GetRegion() string {
- if x != nil {
- return x.Region
- }
- return ""
-}
-
-func (x *S3Config) GetAccessKey() string {
- if x != nil {
- return x.AccessKey
- }
- return ""
-}
-
-func (x *S3Config) GetSecretKey() string {
- if x != nil {
- return x.SecretKey
- }
- return ""
-}
-
-func (x *S3Config) GetBucket() string {
- if x != nil {
- return x.Bucket
- }
- return ""
-}
-
-func (x *S3Config) GetUrlPrefix() string {
- if x != nil {
- return x.UrlPrefix
- }
- return ""
-}
-
-func (x *S3Config) GetUrlSuffix() string {
- if x != nil {
- return x.UrlSuffix
- }
- return ""
-}
-
-func (x *S3Config) GetPreSign() bool {
- if x != nil {
- return x.PreSign
- }
- return false
-}
-
-var File_store_storage_proto protoreflect.FileDescriptor
-
-var file_store_storage_proto_rawDesc = []byte{
- 0x0a, 0x13, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f,
- 0x72, 0x65, 0x22, 0xb6, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x0e,
- 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
- 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53,
- 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70,
- 0x65, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e,
- 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x24, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
- 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
- 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x01, 0x22, 0x57, 0x0a, 0x0d, 0x53,
- 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x09,
- 0x73, 0x33, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
- 0x15, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x33,
- 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x08, 0x73, 0x33, 0x43, 0x6f, 0x6e, 0x66,
- 0x69, 0x67, 0x42, 0x10, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x22, 0x82, 0x02, 0x0a, 0x08, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69,
- 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x12,
- 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61,
- 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63,
- 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
- 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63,
- 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
- 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b,
- 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74,
- 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x07,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12,
- 0x1d, 0x0a, 0x0a, 0x75, 0x72, 0x6c, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x08, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x72, 0x6c, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x19,
- 0x0a, 0x08, 0x70, 0x72, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x07, 0x70, 0x72, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x97, 0x01, 0x0a, 0x0f, 0x63, 0x6f,
- 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0c, 0x53,
- 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67,
- 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d,
- 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
- 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02,
- 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d,
- 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d,
- 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
- 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74,
- 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_store_storage_proto_rawDescOnce sync.Once
- file_store_storage_proto_rawDescData = file_store_storage_proto_rawDesc
-)
-
-func file_store_storage_proto_rawDescGZIP() []byte {
- file_store_storage_proto_rawDescOnce.Do(func() {
- file_store_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_storage_proto_rawDescData)
- })
- return file_store_storage_proto_rawDescData
-}
-
-var file_store_storage_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_store_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
-var file_store_storage_proto_goTypes = []interface{}{
- (Storage_Type)(0), // 0: memos.store.Storage.Type
- (*Storage)(nil), // 1: memos.store.Storage
- (*StorageConfig)(nil), // 2: memos.store.StorageConfig
- (*S3Config)(nil), // 3: memos.store.S3Config
-}
-var file_store_storage_proto_depIdxs = []int32{
- 0, // 0: memos.store.Storage.type:type_name -> memos.store.Storage.Type
- 2, // 1: memos.store.Storage.config:type_name -> memos.store.StorageConfig
- 3, // 2: memos.store.StorageConfig.s3_config:type_name -> memos.store.S3Config
- 3, // [3:3] is the sub-list for method output_type
- 3, // [3:3] is the sub-list for method input_type
- 3, // [3:3] is the sub-list for extension type_name
- 3, // [3:3] is the sub-list for extension extendee
- 0, // [0:3] is the sub-list for field type_name
-}
-
-func init() { file_store_storage_proto_init() }
-func file_store_storage_proto_init() {
- if File_store_storage_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_store_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Storage); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_store_storage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*StorageConfig); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_store_storage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*S3Config); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- file_store_storage_proto_msgTypes[1].OneofWrappers = []interface{}{
- (*StorageConfig_S3Config)(nil),
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_store_storage_proto_rawDesc,
- NumEnums: 1,
- NumMessages: 3,
- NumExtensions: 0,
- NumServices: 0,
- },
- GoTypes: file_store_storage_proto_goTypes,
- DependencyIndexes: file_store_storage_proto_depIdxs,
- EnumInfos: file_store_storage_proto_enumTypes,
- MessageInfos: file_store_storage_proto_msgTypes,
- }.Build()
- File_store_storage_proto = out.File
- file_store_storage_proto_rawDesc = nil
- file_store_storage_proto_goTypes = nil
- file_store_storage_proto_depIdxs = nil
-}
diff --git a/proto/store/storage.proto b/proto/store/storage.proto
deleted file mode 100644
index 675ab5d5c..000000000
--- a/proto/store/storage.proto
+++ /dev/null
@@ -1,35 +0,0 @@
-syntax = "proto3";
-
-package memos.store;
-
-option go_package = "gen/store";
-
-message Storage {
- int32 id = 1;
- string name = 2;
-
- enum Type {
- TYPE_UNSPECIFIED = 0;
- S3 = 1;
- }
- Type type = 3;
- StorageConfig config = 4;
-}
-
-message StorageConfig {
- oneof storage_config {
- S3Config s3_config = 1;
- }
-}
-
-message S3Config {
- string end_point = 1;
- string path = 2;
- string region = 3;
- string access_key = 4;
- string secret_key = 5;
- string bucket = 6;
- string url_prefix = 7;
- string url_suffix = 8;
- bool pre_sign = 9;
-}
diff --git a/server/route/api/v1/storage_service.go b/server/route/api/v1/storage_service.go
deleted file mode 100644
index c5ba61401..000000000
--- a/server/route/api/v1/storage_service.go
+++ /dev/null
@@ -1,156 +0,0 @@
-package v1
-
-import (
- "context"
-
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-
- v1pb "github.com/usememos/memos/proto/gen/api/v1"
- storepb "github.com/usememos/memos/proto/gen/store"
- "github.com/usememos/memos/store"
-)
-
-func (s *APIV1Service) CreateStorage(ctx context.Context, request *v1pb.CreateStorageRequest) (*v1pb.CreateStorageResponse, error) {
- currentUser, err := getCurrentUser(ctx, s.Store)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser.Role != store.RoleHost {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- storage, err := s.Store.CreateStorage(ctx, convertStorageToStore(request.Storage))
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to create storage, error: %+v", err)
- }
- return &v1pb.CreateStorageResponse{
- Storage: ConvertStorageFromStore(storage),
- }, nil
-}
-
-func (s *APIV1Service) ListStorages(ctx context.Context, _ *v1pb.ListStoragesRequest) (*v1pb.ListStoragesResponse, error) {
- storages, err := s.Store.ListStorages(ctx, &store.FindStorage{})
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to list storages, error: %+v", err)
- }
-
- response := &v1pb.ListStoragesResponse{
- Storages: []*v1pb.Storage{},
- }
- for _, storage := range storages {
- response.Storages = append(response.Storages, ConvertStorageFromStore(storage))
- }
- return response, nil
-}
-
-func (s *APIV1Service) GetStorage(ctx context.Context, request *v1pb.GetStorageRequest) (*v1pb.GetStorageResponse, error) {
- storage, err := s.Store.GetStorage(ctx, &store.FindStorage{
- ID: &request.Id,
- })
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get storage, error: %+v", err)
- }
- if storage == nil {
- return nil, status.Errorf(codes.NotFound, "storage not found")
- }
- return &v1pb.GetStorageResponse{
- Storage: ConvertStorageFromStore(storage),
- }, nil
-}
-
-func (s *APIV1Service) UpdateStorage(ctx context.Context, request *v1pb.UpdateStorageRequest) (*v1pb.UpdateStorageResponse, error) {
- if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 {
- return nil, status.Errorf(codes.InvalidArgument, "update_mask is required")
- }
-
- update := &store.UpdateStorageV1{
- ID: request.Storage.Id,
- Type: storepb.Storage_Type(storepb.Storage_Type_value[request.Storage.Type.String()]),
- }
- for _, field := range request.UpdateMask.Paths {
- switch field {
- case "name":
- update.Name = &request.Storage.Title
- case "config":
- update.Config = convertStorageConfigToStore(request.Storage.Type, request.Storage.Config)
- }
- }
-
- storage, err := s.Store.UpdateStorage(ctx, update)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to update storage, error: %+v", err)
- }
- return &v1pb.UpdateStorageResponse{
- Storage: ConvertStorageFromStore(storage),
- }, nil
-}
-
-func (s *APIV1Service) DeleteStorage(ctx context.Context, request *v1pb.DeleteStorageRequest) (*v1pb.DeleteStorageResponse, error) {
- err := s.Store.DeleteStorage(ctx, &store.DeleteStorage{
- ID: request.Id,
- })
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to delete storage, error: %+v", err)
- }
- return &v1pb.DeleteStorageResponse{}, nil
-}
-
-func ConvertStorageFromStore(storage *storepb.Storage) *v1pb.Storage {
- temp := &v1pb.Storage{
- Id: storage.Id,
- Title: storage.Name,
- Type: v1pb.Storage_Type(v1pb.Storage_Type_value[storage.Type.String()]),
- }
- if storage.Type == storepb.Storage_S3 {
- s3Config := storage.Config.GetS3Config()
- temp.Config = &v1pb.StorageConfig{
- Config: &v1pb.StorageConfig_S3Config{
- S3Config: &v1pb.S3Config{
- EndPoint: s3Config.EndPoint,
- Path: s3Config.Path,
- Region: s3Config.Region,
- AccessKey: s3Config.AccessKey,
- SecretKey: s3Config.SecretKey,
- Bucket: s3Config.Bucket,
- UrlPrefix: s3Config.UrlPrefix,
- UrlSuffix: s3Config.UrlSuffix,
- PreSign: s3Config.PreSign,
- },
- },
- }
- }
- return temp
-}
-
-func convertStorageToStore(storage *v1pb.Storage) *storepb.Storage {
- temp := &storepb.Storage{
- Id: storage.Id,
- Name: storage.Title,
- Type: storepb.Storage_Type(storepb.Storage_Type_value[storage.Type.String()]),
- Config: convertStorageConfigToStore(storage.Type, storage.Config),
- }
- return temp
-}
-
-func convertStorageConfigToStore(storageType v1pb.Storage_Type, config *v1pb.StorageConfig) *storepb.StorageConfig {
- if storageType == v1pb.Storage_S3 {
- s3Config := config.GetS3Config()
- return &storepb.StorageConfig{
- StorageConfig: &storepb.StorageConfig_S3Config{
- S3Config: &storepb.S3Config{
- EndPoint: s3Config.EndPoint,
- Path: s3Config.Path,
- Region: s3Config.Region,
- AccessKey: s3Config.AccessKey,
- SecretKey: s3Config.SecretKey,
- Bucket: s3Config.Bucket,
- UrlPrefix: s3Config.UrlPrefix,
- UrlSuffix: s3Config.UrlSuffix,
- PreSign: s3Config.PreSign,
- },
- },
- }
- }
- return nil
-}
diff --git a/server/route/api/v1/v1.go b/server/route/api/v1/v1.go
index b725ecdc8..77a7ec8f1 100644
--- a/server/route/api/v1/v1.go
+++ b/server/route/api/v1/v1.go
@@ -28,7 +28,6 @@ type APIV1Service struct {
v1pb.UnimplementedActivityServiceServer
v1pb.UnimplementedWebhookServiceServer
v1pb.UnimplementedLinkServiceServer
- v1pb.UnimplementedStorageServiceServer
v1pb.UnimplementedIdentityProviderServiceServer
Secret string
@@ -57,7 +56,6 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
v1pb.RegisterActivityServiceServer(grpcServer, apiv1Service)
v1pb.RegisterWebhookServiceServer(grpcServer, apiv1Service)
v1pb.RegisterLinkServiceServer(grpcServer, apiv1Service)
- v1pb.RegisterStorageServiceServer(grpcServer, apiv1Service)
v1pb.RegisterIdentityProviderServiceServer(grpcServer, apiv1Service)
reflection.Register(grpcServer)
return apiv1Service
@@ -110,9 +108,6 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech
if err := v1pb.RegisterLinkServiceHandler(context.Background(), gwMux, conn); err != nil {
return err
}
- if err := v1pb.RegisterStorageServiceHandler(context.Background(), gwMux, conn); err != nil {
- return err
- }
if err := v1pb.RegisterIdentityProviderServiceHandler(context.Background(), gwMux, conn); err != nil {
return err
}
diff --git a/store/db/mysql/storage.go b/store/db/mysql/storage.go
deleted file mode 100644
index 6b667af78..000000000
--- a/store/db/mysql/storage.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package mysql
-
-import (
- "context"
- "strings"
-
- "github.com/usememos/memos/store"
-)
-
-func (d *DB) CreateStorage(ctx context.Context, create *store.Storage) (*store.Storage, error) {
- fields := []string{"`name`", "`type`", "`config`"}
- placeholder := []string{"?", "?", "?"}
- args := []any{create.Name, create.Type, create.Config}
-
- stmt := "INSERT INTO `storage` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")"
- result, err := d.db.ExecContext(ctx, stmt, args...)
- if err != nil {
- return nil, err
- }
-
- id, err := result.LastInsertId()
- if err != nil {
- return nil, err
- }
-
- create.ID = int32(id)
- return create, nil
-}
-
-func (d *DB) ListStorages(ctx context.Context, find *store.FindStorage) ([]*store.Storage, error) {
- where, args := []string{"1 = 1"}, []any{}
- if find.ID != nil {
- where, args = append(where, "`id` = ?"), append(args, *find.ID)
- }
-
- rows, err := d.db.QueryContext(ctx, "SELECT `id`, `name`, `type`, `config` FROM `storage` WHERE "+strings.Join(where, " AND ")+" ORDER BY `id` DESC",
- args...,
- )
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- list := []*store.Storage{}
- for rows.Next() {
- storage := &store.Storage{}
- if err := rows.Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
- list = append(list, storage)
- }
-
- if err := rows.Err(); err != nil {
- return nil, err
- }
-
- return list, nil
-}
-
-func (d *DB) UpdateStorage(ctx context.Context, update *store.UpdateStorage) (*store.Storage, error) {
- set, args := []string{}, []any{}
- if update.Name != nil {
- set = append(set, "`name` = ?")
- args = append(args, *update.Name)
- }
- if update.Config != nil {
- set = append(set, "`config` = ?")
- args = append(args, *update.Config)
- }
- args = append(args, update.ID)
-
- stmt := "UPDATE `storage` SET " + strings.Join(set, ", ") + " WHERE `id` = ?"
- _, err := d.db.ExecContext(ctx, stmt, args...)
- if err != nil {
- return nil, err
- }
-
- storage := &store.Storage{}
- stmt = "SELECT `id`, `name`, `type`, `config` FROM `storage` WHERE `id` = ?"
- if err := d.db.QueryRowContext(ctx, stmt, update.ID).Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
-
- return storage, nil
-}
-
-func (d *DB) DeleteStorage(ctx context.Context, delete *store.DeleteStorage) error {
- stmt := "DELETE FROM `storage` WHERE `id` = ?"
- result, err := d.db.ExecContext(ctx, stmt, delete.ID)
- if err != nil {
- return err
- }
- if _, err := result.RowsAffected(); err != nil {
- return err
- }
- return nil
-}
diff --git a/store/db/postgres/storage.go b/store/db/postgres/storage.go
deleted file mode 100644
index e3610d17a..000000000
--- a/store/db/postgres/storage.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package postgres
-
-import (
- "context"
- "strings"
-
- "github.com/usememos/memos/store"
-)
-
-func (d *DB) CreateStorage(ctx context.Context, create *store.Storage) (*store.Storage, error) {
- fields := []string{"name", "type", "config"}
- args := []any{create.Name, create.Type, create.Config}
-
- stmt := "INSERT INTO storage (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id"
- if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
- &create.ID,
- ); err != nil {
- return nil, err
- }
-
- storage := create
- return storage, nil
-}
-
-func (d *DB) ListStorages(ctx context.Context, find *store.FindStorage) ([]*store.Storage, error) {
- where, args := []string{"1 = 1"}, []any{}
- if find.ID != nil {
- where, args = append(where, "id = "+placeholder(len(args)+1)), append(args, *find.ID)
- }
-
- rows, err := d.db.QueryContext(ctx, `
- SELECT
- id,
- name,
- type,
- config
- FROM storage
- WHERE `+strings.Join(where, " AND ")+`
- ORDER BY id DESC`,
- args...,
- )
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- list := []*store.Storage{}
- for rows.Next() {
- storage := &store.Storage{}
- if err := rows.Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
- list = append(list, storage)
- }
-
- if err := rows.Err(); err != nil {
- return nil, err
- }
-
- return list, nil
-}
-
-func (d *DB) UpdateStorage(ctx context.Context, update *store.UpdateStorage) (*store.Storage, error) {
- set, args := []string{}, []any{}
- if update.Name != nil {
- set, args = append(set, "name = "+placeholder(len(args)+1)), append(args, *update.Name)
- }
- if update.Config != nil {
- set, args = append(set, "config = "+placeholder(len(args)+1)), append(args, *update.Config)
- }
-
- stmt := `UPDATE storage SET ` + strings.Join(set, ", ") + ` WHERE id = ` + placeholder(len(args)+1) + ` RETURNING id, name, type, config`
- args = append(args, update.ID)
- storage := &store.Storage{}
- if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
-
- return storage, nil
-}
-
-func (d *DB) DeleteStorage(ctx context.Context, delete *store.DeleteStorage) error {
- stmt := `DELETE FROM storage WHERE id = $1`
- result, err := d.db.ExecContext(ctx, stmt, delete.ID)
- if err != nil {
- return err
- }
- if _, err := result.RowsAffected(); err != nil {
- return err
- }
- return nil
-}
diff --git a/store/db/sqlite/storage.go b/store/db/sqlite/storage.go
deleted file mode 100644
index c0b1d35b7..000000000
--- a/store/db/sqlite/storage.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package sqlite
-
-import (
- "context"
- "strings"
-
- "github.com/usememos/memos/store"
-)
-
-func (d *DB) CreateStorage(ctx context.Context, create *store.Storage) (*store.Storage, error) {
- fields := []string{"`name`", "`type`", "`config`"}
- placeholder := []string{"?", "?", "?"}
- args := []any{create.Name, create.Type, create.Config}
-
- stmt := "INSERT INTO `storage` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`"
- if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
- &create.ID,
- ); err != nil {
- return nil, err
- }
-
- storage := create
- return storage, nil
-}
-
-func (d *DB) ListStorages(ctx context.Context, find *store.FindStorage) ([]*store.Storage, error) {
- where, args := []string{"1 = 1"}, []any{}
- if find.ID != nil {
- where, args = append(where, "id = ?"), append(args, *find.ID)
- }
-
- rows, err := d.db.QueryContext(ctx, `
- SELECT
- id,
- name,
- type,
- config
- FROM storage
- WHERE `+strings.Join(where, " AND ")+`
- ORDER BY id DESC`,
- args...,
- )
- if err != nil {
- return nil, err
- }
- defer rows.Close()
-
- list := []*store.Storage{}
- for rows.Next() {
- storage := &store.Storage{}
- if err := rows.Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
- list = append(list, storage)
- }
-
- if err := rows.Err(); err != nil {
- return nil, err
- }
-
- return list, nil
-}
-
-func (d *DB) UpdateStorage(ctx context.Context, update *store.UpdateStorage) (*store.Storage, error) {
- set, args := []string{}, []any{}
- if update.Name != nil {
- set = append(set, "name = ?")
- args = append(args, *update.Name)
- }
- if update.Config != nil {
- set = append(set, "config = ?")
- args = append(args, *update.Config)
- }
- args = append(args, update.ID)
-
- stmt := `
- UPDATE storage
- SET ` + strings.Join(set, ", ") + `
- WHERE id = ?
- RETURNING
- id,
- name,
- type,
- config
- `
- storage := &store.Storage{}
- if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
- &storage.ID,
- &storage.Name,
- &storage.Type,
- &storage.Config,
- ); err != nil {
- return nil, err
- }
-
- return storage, nil
-}
-
-func (d *DB) DeleteStorage(ctx context.Context, delete *store.DeleteStorage) error {
- stmt := `
- DELETE FROM storage
- WHERE id = ?
- `
- result, err := d.db.ExecContext(ctx, stmt, delete.ID)
- if err != nil {
- return err
- }
- if _, err := result.RowsAffected(); err != nil {
- return err
- }
- return nil
-}
diff --git a/store/driver.go b/store/driver.go
index 8ff90ca36..13f8e1939 100644
--- a/store/driver.go
+++ b/store/driver.go
@@ -73,12 +73,6 @@ type Driver interface {
ListTags(ctx context.Context, find *FindTag) ([]*Tag, error)
DeleteTag(ctx context.Context, delete *DeleteTag) error
- // Storage model related methods.
- CreateStorage(ctx context.Context, create *Storage) (*Storage, error)
- ListStorages(ctx context.Context, find *FindStorage) ([]*Storage, error)
- UpdateStorage(ctx context.Context, update *UpdateStorage) (*Storage, error)
- DeleteStorage(ctx context.Context, delete *DeleteStorage) error
-
// Inbox model related methods.
CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error)
ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error)
diff --git a/store/storage.go b/store/storage.go
deleted file mode 100644
index beb73c59f..000000000
--- a/store/storage.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package store
-
-import (
- "context"
-
- "github.com/pkg/errors"
- "google.golang.org/protobuf/encoding/protojson"
-
- storepb "github.com/usememos/memos/proto/gen/store"
-)
-
-type Storage struct {
- ID int32
- Name string
- Type string
- Config string
-}
-
-type FindStorage struct {
- ID *int32
-}
-
-type UpdateStorage struct {
- ID int32
- Name *string
- Config *string
-}
-
-type DeleteStorage struct {
- ID int32
-}
-
-func (s *Store) CreateStorage(ctx context.Context, create *storepb.Storage) (*storepb.Storage, error) {
- storageRaw := &Storage{
- Name: create.Name,
- Type: create.Type.String(),
- }
-
- if create.Type == storepb.Storage_S3 {
- configBytes, err := protojson.Marshal(create.Config.GetS3Config())
- if err != nil {
- return nil, errors.Wrap(err, "failed to marshal s3 config")
- }
- storageRaw.Config = string(configBytes)
- }
-
- storageRaw, err := s.driver.CreateStorage(ctx, storageRaw)
- if err != nil {
- return nil, err
- }
- storage, err := convertStorageFromRaw(storageRaw)
- if err != nil {
- return nil, err
- }
- return storage, nil
-}
-
-func (s *Store) ListStorages(ctx context.Context, find *FindStorage) ([]*storepb.Storage, error) {
- list, err := s.driver.ListStorages(ctx, find)
- if err != nil {
- return nil, err
- }
-
- storages := []*storepb.Storage{}
- for _, storageRaw := range list {
- storage, err := convertStorageFromRaw(storageRaw)
- if err != nil {
- return nil, err
- }
- storages = append(storages, storage)
- }
- return storages, nil
-}
-
-func (s *Store) GetStorage(ctx context.Context, find *FindStorage) (*storepb.Storage, error) {
- list, err := s.ListStorages(ctx, find)
- if err != nil {
- return nil, err
- }
- if len(list) == 0 {
- return nil, nil
- }
-
- return list[0], nil
-}
-
-type UpdateStorageV1 struct {
- ID int32
- Type storepb.Storage_Type
- Name *string
- Config *storepb.StorageConfig
-}
-
-func (s *Store) UpdateStorage(ctx context.Context, update *UpdateStorageV1) (*storepb.Storage, error) {
- updateRaw := &UpdateStorage{
- ID: update.ID,
- }
- if update.Name != nil {
- updateRaw.Name = update.Name
- }
- if update.Config != nil {
- configRaw, err := convertStorageConfigToRaw(update.Type, update.Config)
- if err != nil {
- return nil, err
- }
- updateRaw.Config = &configRaw
- }
- storageRaw, err := s.driver.UpdateStorage(ctx, updateRaw)
- if err != nil {
- return nil, err
- }
- storage, err := convertStorageFromRaw(storageRaw)
- if err != nil {
- return nil, err
- }
- return storage, nil
-}
-
-func (s *Store) DeleteStorage(ctx context.Context, delete *DeleteStorage) error {
- return s.driver.DeleteStorage(ctx, delete)
-}
-
-func convertStorageFromRaw(storageRaw *Storage) (*storepb.Storage, error) {
- storage := &storepb.Storage{
- Id: storageRaw.ID,
- Name: storageRaw.Name,
- Type: storepb.Storage_Type(storepb.Storage_Type_value[storageRaw.Type]),
- }
- storageConfig, err := convertStorageConfigFromRaw(storage.Type, storageRaw.Config)
- if err != nil {
- return nil, err
- }
- storage.Config = storageConfig
- return storage, nil
-}
-
-func convertStorageConfigFromRaw(storageType storepb.Storage_Type, configRaw string) (*storepb.StorageConfig, error) {
- storageConfig := &storepb.StorageConfig{}
- if storageType == storepb.Storage_S3 {
- s3Config := &storepb.S3Config{}
- err := protojsonUnmarshaler.Unmarshal([]byte(configRaw), s3Config)
- if err != nil {
- return nil, err
- }
- storageConfig.StorageConfig = &storepb.StorageConfig_S3Config{S3Config: s3Config}
- }
- return storageConfig, nil
-}
-
-func convertStorageConfigToRaw(storageType storepb.Storage_Type, config *storepb.StorageConfig) (string, error) {
- raw := ""
- if storageType == storepb.Storage_S3 {
- bytes, err := protojson.Marshal(config.GetS3Config())
- if err != nil {
- return "", err
- }
- raw = string(bytes)
- }
- return raw, nil
-}
diff --git a/test/store/storage_test.go b/test/store/storage_test.go
deleted file mode 100644
index 57d47d8b5..000000000
--- a/test/store/storage_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package teststore
-
-import (
- "context"
- "testing"
-
- "github.com/stretchr/testify/require"
-
- storepb "github.com/usememos/memos/proto/gen/store"
- "github.com/usememos/memos/store"
-)
-
-func TestStorageStore(t *testing.T) {
- ctx := context.Background()
- ts := NewTestingStore(ctx, t)
- storage, err := ts.CreateStorage(ctx, &storepb.Storage{
- Name: "test_storage",
- Type: storepb.Storage_S3,
- Config: &storepb.StorageConfig{
- StorageConfig: &storepb.StorageConfig_S3Config{
- S3Config: &storepb.S3Config{
- EndPoint: "http://localhost:9000",
- },
- },
- },
- })
- require.NoError(t, err)
- newStorageName := "new_storage_name"
- updatedStorage, err := ts.UpdateStorage(ctx, &store.UpdateStorageV1{
- ID: storage.Id,
- Type: storage.Type,
- Name: &newStorageName,
- })
- require.NoError(t, err)
- require.Equal(t, newStorageName, updatedStorage.Name)
- storageList, err := ts.ListStorages(ctx, &store.FindStorage{})
- require.NoError(t, err)
- require.Equal(t, 1, len(storageList))
- require.Equal(t, updatedStorage, storageList[0])
- err = ts.DeleteStorage(ctx, &store.DeleteStorage{
- ID: storage.Id,
- })
- require.NoError(t, err)
- storageList, err = ts.ListStorages(ctx, &store.FindStorage{})
- require.NoError(t, err)
- require.Equal(t, 0, len(storageList))
- ts.Close()
-}
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 5d6b39fc4..3802479b3 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -2,7 +2,7 @@ import { useColorScheme } from "@mui/joy";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { Outlet } from "react-router-dom";
-import storage from "./helpers/storage";
+import useLocalStorage from "react-use/lib/useLocalStorage";
import { getSystemColorScheme } from "./helpers/utils";
import useNavigateTo from "./hooks/useNavigateTo";
import { useCommonContext } from "./layouts/CommonContextProvider";
@@ -16,8 +16,11 @@ const App = () => {
const workspaceSettingStore = useWorkspaceSettingStore();
const userStore = useUserStore();
const commonContext = useCommonContext();
+ const [, setLocale] = useLocalStorage("locale", "en");
+ const [, setAppearance] = useLocalStorage("appearance", "system");
const workspaceProfile = commonContext.profile;
const userSetting = userStore.userSetting;
+
const workspaceGeneralSetting =
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL).generalSetting ||
WorkspaceGeneralSetting.fromPartial({});
@@ -86,9 +89,7 @@ const App = () => {
} else {
document.documentElement.setAttribute("dir", "ltr");
}
- storage.set({
- locale: currentLocale,
- });
+ setLocale(currentLocale);
}, [commonContext.locale]);
useEffect(() => {
@@ -97,9 +98,7 @@ const App = () => {
currentAppearance = getSystemColorScheme();
}
setMode(currentAppearance);
- storage.set({
- appearance: currentAppearance,
- });
+ setAppearance(currentAppearance);
}, [commonContext.appearance]);
useEffect(() => {
diff --git a/web/src/helpers/storage.ts b/web/src/helpers/storage.ts
deleted file mode 100644
index 7807a06dd..000000000
--- a/web/src/helpers/storage.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Define storage data type
- */
-interface StorageData {
- // locale
- locale: Locale;
- // appearance
- appearance: Appearance;
-}
-
-type StorageKey = keyof StorageData;
-
-const storage = {
- get: (keys: StorageKey[]): Partial<StorageData> => {
- const data: Partial<StorageData> = {};
-
- for (const key of keys) {
- try {
- const stringifyValue = localStorage.getItem(key);
- if (stringifyValue !== null) {
- const val = JSON.parse(stringifyValue);
- data[key] = val;
- }
- } catch (error: any) {
- console.error("Get storage failed in ", key, error);
- }
- }
-
- return data;
- },
- set: (data: Partial<StorageData>) => {
- for (const key in data) {
- try {
- const stringifyValue = JSON.stringify(data[key as StorageKey]);
- localStorage.setItem(key, stringifyValue);
- } catch (error: any) {
- console.error("Save storage failed in ", key, error);
- }
- }
- },
- remove: (keys: StorageKey[]) => {
- for (const key of keys) {
- try {
- localStorage.removeItem(key);
- } catch (error: any) {
- console.error("Remove storage failed in ", key, error);
- }
- }
- },
-};
-
-export default storage;
diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx
index 38bb6cb81..50771c662 100644
--- a/web/src/layouts/CommonContextProvider.tsx
+++ b/web/src/layouts/CommonContextProvider.tsx
@@ -1,6 +1,6 @@
import { createContext, useContext, useEffect, useState } from "react";
+import useLocalStorage from "react-use/lib/useLocalStorage";
import { workspaceServiceClient } from "@/grpcweb";
-import storage from "@/helpers/storage";
import { useUserStore, useWorkspaceSettingStore } from "@/store/v1";
import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service";
import { WorkspaceGeneralSetting, WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
@@ -30,6 +30,8 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => {
appearance: "system",
profile: WorkspaceProfile.fromPartial({}),
});
+ const [locale] = useLocalStorage("locale", "en");
+ const [appearance] = useLocalStorage("appearance", "system");
useEffect(() => {
const initialWorkspace = async () => {
@@ -39,8 +41,6 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => {
const workspaceGeneralSetting =
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL).generalSetting ||
WorkspaceGeneralSetting.fromPartial({});
- const { locale } = storage.get(["locale"]);
- const { appearance } = storage.get(["appearance"]);
setCommonContext({
locale: locale || workspaceGeneralSetting.customProfile?.locale || "en",
appearance: appearance || workspaceGeneralSetting.customProfile?.appearance || "system",