Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
b0aad6f6
Commit
b0aad6f6
authored
May 17, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: tweak resource payload
parent
0c251f9a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
237 additions
and
204 deletions
+237
-204
apidocs.swagger.yaml
docs/apidocs.swagger.yaml
+15
-15
s3.go
plugin/storage/s3/s3.go
+1
-1
resource.pb.go
proto/gen/store/resource.pb.go
+55
-39
workspace_setting.pb.go
proto/gen/store/workspace_setting.pb.go
+121
-121
resource.proto
proto/store/resource.proto
+4
-2
workspace_setting.proto
proto/store/workspace_setting.proto
+10
-9
memo_service.go
server/router/api/v1/memo_service.go
+5
-5
resource_service.go
server/router/api/v1/resource_service.go
+1
-0
workspace_setting_service.go
server/router/api/v1/workspace_setting_service.go
+1
-1
s3_object_presigner.go
server/service/s3_object_presigner/s3_object_presigner.go
+18
-9
resource.go
store/resource.go
+6
-2
No files found.
docs/apidocs.swagger.yaml
View file @
b0aad6f6
...
...
@@ -1850,6 +1850,20 @@ definitions:
expiresAt
:
type
:
string
format
:
date-time
WorkspaceStorageSettingS3Config
:
type
:
object
properties
:
accessKeyId
:
type
:
string
accessKeySecret
:
type
:
string
endpoint
:
type
:
string
region
:
type
:
string
bucket
:
type
:
string
title
:
'
Reference:
https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiHttpBody
:
type
:
object
properties
:
...
...
@@ -2086,22 +2100,8 @@ definitions:
format
:
int64
description
:
The max upload size in megabytes.
s3Config
:
$ref
:
'
#/definitions/
apiv1
WorkspaceStorageSettingS3Config'
$ref
:
'
#/definitions/WorkspaceStorageSettingS3Config'
description
:
The S3 config.
apiv1WorkspaceStorageSettingS3Config
:
type
:
object
properties
:
accessKeyId
:
type
:
string
accessKeySecret
:
type
:
string
endpoint
:
type
:
string
region
:
type
:
string
bucket
:
type
:
string
title
:
'
Reference:
https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiv1WorkspaceStorageSettingStorageType
:
type
:
string
enum
:
...
...
plugin/storage/s3/s3.go
View file @
b0aad6f6
...
...
@@ -20,7 +20,7 @@ type Client struct {
Bucket
*
string
}
func
NewClient
(
ctx
context
.
Context
,
s3Config
*
storepb
.
WorkspaceStorageSetting_
S3Config
)
(
*
Client
,
error
)
{
func
NewClient
(
ctx
context
.
Context
,
s3Config
*
storepb
.
Storage
S3Config
)
(
*
Client
,
error
)
{
resolver
:=
aws
.
EndpointResolverWithOptionsFunc
(
func
(
service
,
region
string
,
options
...
any
)
(
aws
.
Endpoint
,
error
)
{
return
aws
.
Endpoint
{
URL
:
s3Config
.
Endpoint
,
...
...
proto/gen/store/resource.pb.go
View file @
b0aad6f6
...
...
@@ -145,11 +145,12 @@ type ResourcePayload_S3Object struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
S3Config
*
StorageS3Config
`protobuf:"bytes,1,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
// key is the S3 object key.
Key
string
`protobuf:"bytes,
1
,opt,name=key,proto3" json:"key,omitempty"`
Key
string
`protobuf:"bytes,
2
,opt,name=key,proto3" json:"key,omitempty"`
// last_presigned_time is the last time the object was presigned.
// This is used to determine if the presigned URL is still valid.
LastPresignedTime
*
timestamppb
.
Timestamp
`protobuf:"bytes,
2
,opt,name=last_presigned_time,json=lastPresignedTime,proto3" json:"last_presigned_time,omitempty"`
LastPresignedTime
*
timestamppb
.
Timestamp
`protobuf:"bytes,
3
,opt,name=last_presigned_time,json=lastPresignedTime,proto3" json:"last_presigned_time,omitempty"`
}
func
(
x
*
ResourcePayload_S3Object
)
Reset
()
{
...
...
@@ -184,6 +185,13 @@ func (*ResourcePayload_S3Object) Descriptor() ([]byte, []int) {
return
file_store_resource_proto_rawDescGZIP
(),
[]
int
{
0
,
0
}
}
func
(
x
*
ResourcePayload_S3Object
)
GetS3Config
()
*
StorageS3Config
{
if
x
!=
nil
{
return
x
.
S3Config
}
return
nil
}
func
(
x
*
ResourcePayload_S3Object
)
GetKey
()
string
{
if
x
!=
nil
{
return
x
.
Key
...
...
@@ -205,36 +213,41 @@ var file_store_resource_proto_rawDesc = []byte{
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x12
,
0x0b
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x1a
,
0x1f
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2f
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x73
,
0x74
,
0x61
,
0x6d
,
0x70
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x22
,
0xcc
,
0x01
,
0x0a
,
0x0f
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x50
,
0x61
,
0x79
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x12
,
0x44
,
0x0a
,
0x09
,
0x73
,
0x33
,
0x5f
,
0x6f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x25
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x2e
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x50
,
0x61
,
0x79
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x2e
,
0x53
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x48
,
0x00
,
0x52
,
0x08
,
0x73
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x1a
,
0x68
,
0x0a
,
0x08
,
0x53
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x12
,
0x10
,
0x0a
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x12
,
0x4a
,
0x0a
,
0x13
,
0x6c
,
0x61
,
0x73
,
0x74
,
0x5f
,
0x70
,
0x72
,
0x65
,
0x73
,
0x69
,
0x67
,
0x6e
,
0x65
,
0x64
,
0x5f
,
0x74
,
0x69
,
0x6d
,
0x65
,
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
,
0x54
,
0x69
,
0x6d
,
0x65
,
0x73
,
0x74
,
0x61
,
0x6d
,
0x70
,
0x52
,
0x11
,
0x6c
,
0x61
,
0x73
,
0x74
,
0x50
,
0x72
,
0x65
,
0x73
,
0x69
,
0x67
,
0x6e
,
0x65
,
0x64
,
0x54
,
0x69
,
0x6d
,
0x65
,
0x42
,
0x09
,
0x0a
,
0x07
,
0x70
,
0x61
,
0x79
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x2a
,
0x5d
,
0x0a
,
0x13
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x54
,
0x79
,
0x70
,
0x65
,
0x12
,
0x25
,
0x0a
,
0x21
,
0x52
,
0x45
,
0x53
,
0x4f
,
0x55
,
0x52
,
0x43
,
0x45
,
0x5f
,
0x53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x45
,
0x5f
,
0x54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x09
,
0x0a
,
0x05
,
0x4c
,
0x4f
,
0x43
,
0x41
,
0x4c
,
0x10
,
0x01
,
0x12
,
0x06
,
0x0a
,
0x02
,
0x53
,
0x33
,
0x10
,
0x02
,
0x12
,
0x0c
,
0x0a
,
0x08
,
0x45
,
0x58
,
0x54
,
0x45
,
0x52
,
0x4e
,
0x41
,
0x4c
,
0x10
,
0x03
,
0x42
,
0x98
,
0x01
,
0x0a
,
0x0f
,
0x63
,
0x6f
,
0x6d
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x42
,
0x0d
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
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
,
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
0x74
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x25
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x2e
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x50
,
0x61
,
0x79
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x2e
,
0x53
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x48
,
0x00
,
0x52
,
0x08
,
0x73
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x1a
,
0xa3
,
0x01
,
0x0a
,
0x08
,
0x53
,
0x33
,
0x4f
,
0x62
,
0x6a
,
0x65
,
0x63
,
0x74
,
0x12
,
0x39
,
0x0a
,
0x09
,
0x73
,
0x33
,
0x5f
,
0x63
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x1c
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x2e
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x53
,
0x33
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x52
,
0x08
,
0x73
,
0x33
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x12
,
0x10
,
0x0a
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x03
,
0x6b
,
0x65
,
0x79
,
0x12
,
0x4a
,
0x0a
,
0x13
,
0x6c
,
0x61
,
0x73
,
0x74
,
0x5f
,
0x70
,
0x72
,
0x65
,
0x73
,
0x69
,
0x67
,
0x6e
,
0x65
,
0x64
,
0x5f
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x1a
,
0x2e
,
0x67
,
0x6f
,
0x6f
,
0x67
,
0x6c
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x62
,
0x75
,
0x66
,
0x2e
,
0x54
,
0x69
,
0x6d
,
0x65
,
0x73
,
0x74
,
0x61
,
0x6d
,
0x70
,
0x52
,
0x11
,
0x6c
,
0x61
,
0x73
,
0x74
,
0x50
,
0x72
,
0x65
,
0x73
,
0x69
,
0x67
,
0x6e
,
0x65
,
0x64
,
0x54
,
0x69
,
0x6d
,
0x65
,
0x42
,
0x09
,
0x0a
,
0x07
,
0x70
,
0x61
,
0x79
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x2a
,
0x5d
,
0x0a
,
0x13
,
0x52
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x54
,
0x79
,
0x70
,
0x65
,
0x12
,
0x25
,
0x0a
,
0x21
,
0x52
,
0x45
,
0x53
,
0x4f
,
0x55
,
0x52
,
0x43
,
0x45
,
0x5f
,
0x53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x45
,
0x5f
,
0x54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x09
,
0x0a
,
0x05
,
0x4c
,
0x4f
,
0x43
,
0x41
,
0x4c
,
0x10
,
0x01
,
0x12
,
0x06
,
0x0a
,
0x02
,
0x53
,
0x33
,
0x10
,
0x02
,
0x12
,
0x0c
,
0x0a
,
0x08
,
0x45
,
0x58
,
0x54
,
0x45
,
0x52
,
0x4e
,
0x41
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,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
var
(
...
...
@@ -255,16 +268,18 @@ var file_store_resource_proto_goTypes = []interface{}{
(
ResourceStorageType
)(
0
),
// 0: memos.store.ResourceStorageType
(
*
ResourcePayload
)(
nil
),
// 1: memos.store.ResourcePayload
(
*
ResourcePayload_S3Object
)(
nil
),
// 2: memos.store.ResourcePayload.S3Object
(
*
timestamppb
.
Timestamp
)(
nil
),
// 3: google.protobuf.Timestamp
(
*
StorageS3Config
)(
nil
),
// 3: memos.store.StorageS3Config
(
*
timestamppb
.
Timestamp
)(
nil
),
// 4: google.protobuf.Timestamp
}
var
file_store_resource_proto_depIdxs
=
[]
int32
{
2
,
// 0: memos.store.ResourcePayload.s3_object:type_name -> memos.store.ResourcePayload.S3Object
3
,
// 1: memos.store.ResourcePayload.S3Object.last_presigned_time:type_name -> google.protobuf.Timestamp
2
,
// [2:2] is the sub-list for method output_type
2
,
// [2:2] is the sub-list for method input_type
2
,
// [2:2] is the sub-list for extension type_name
2
,
// [2:2] is the sub-list for extension extendee
0
,
// [0:2] is the sub-list for field type_name
3
,
// 1: memos.store.ResourcePayload.S3Object.s3_config:type_name -> memos.store.StorageS3Config
4
,
// 2: memos.store.ResourcePayload.S3Object.last_presigned_time:type_name -> google.protobuf.Timestamp
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_resource_proto_init
()
}
...
...
@@ -272,6 +287,7 @@ func file_store_resource_proto_init() {
if
File_store_resource_proto
!=
nil
{
return
}
file_store_workspace_setting_proto_init
()
if
!
protoimpl
.
UnsafeEnabled
{
file_store_resource_proto_msgTypes
[
0
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
ResourcePayload
);
i
{
...
...
proto/gen/store/workspace_setting.pb.go
View file @
b0aad6f6
...
...
@@ -483,7 +483,7 @@ type WorkspaceStorageSetting struct {
// The max upload size in megabytes.
UploadSizeLimitMb
int64
`protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"`
// The S3 config.
S3Config
*
WorkspaceStorageSetting_
S3Config
`protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
S3Config
*
Storage
S3Config
`protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
}
func
(
x
*
WorkspaceStorageSetting
)
Reset
()
{
...
...
@@ -539,28 +539,28 @@ func (x *WorkspaceStorageSetting) GetUploadSizeLimitMb() int64 {
return
0
}
func
(
x
*
WorkspaceStorageSetting
)
GetS3Config
()
*
WorkspaceStorageSetting_
S3Config
{
func
(
x
*
WorkspaceStorageSetting
)
GetS3Config
()
*
Storage
S3Config
{
if
x
!=
nil
{
return
x
.
S3Config
}
return
nil
}
type
WorkspaceMemoRelatedSetting
struct
{
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
type
StorageS3Config
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
// disallow_public_share disallows set memo as public visible.
DisallowPublicVisible
bool
`protobuf:"varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3" json:"disallow_public_visible,omitempty"`
// display_with_update_time orders and displays memo with update time.
DisplayWithUpdateTime
bool
`protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
// content_length_limit is the limit of content length. Unit is byte.
ContentLengthLimit
int32
`protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
AccessKeyId
string
`protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
AccessKeySecret
string
`protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
Endpoint
string
`protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
Region
string
`protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
Bucket
string
`protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
}
func
(
x
*
WorkspaceMemoRelatedSettin
g
)
Reset
()
{
*
x
=
WorkspaceMemoRelatedSettin
g
{}
func
(
x
*
StorageS3Confi
g
)
Reset
()
{
*
x
=
StorageS3Confi
g
{}
if
protoimpl
.
UnsafeEnabled
{
mi
:=
&
file_store_workspace_setting_proto_msgTypes
[
5
]
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -568,13 +568,13 @@ func (x *WorkspaceMemoRelatedSetting) Reset() {
}
}
func
(
x
*
WorkspaceMemoRelatedSettin
g
)
String
()
string
{
func
(
x
*
StorageS3Confi
g
)
String
()
string
{
return
protoimpl
.
X
.
MessageStringOf
(
x
)
}
func
(
*
WorkspaceMemoRelatedSettin
g
)
ProtoMessage
()
{}
func
(
*
StorageS3Confi
g
)
ProtoMessage
()
{}
func
(
x
*
WorkspaceMemoRelatedSettin
g
)
ProtoReflect
()
protoreflect
.
Message
{
func
(
x
*
StorageS3Confi
g
)
ProtoReflect
()
protoreflect
.
Message
{
mi
:=
&
file_store_workspace_setting_proto_msgTypes
[
5
]
if
protoimpl
.
UnsafeEnabled
&&
x
!=
nil
{
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -586,47 +586,61 @@ func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
return
mi
.
MessageOf
(
x
)
}
// Deprecated: Use
WorkspaceMemoRelatedSettin
g.ProtoReflect.Descriptor instead.
func
(
*
WorkspaceMemoRelatedSettin
g
)
Descriptor
()
([]
byte
,
[]
int
)
{
// Deprecated: Use
StorageS3Confi
g.ProtoReflect.Descriptor instead.
func
(
*
StorageS3Confi
g
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_store_workspace_setting_proto_rawDescGZIP
(),
[]
int
{
5
}
}
func
(
x
*
WorkspaceMemoRelatedSetting
)
GetDisallowPublicVisible
()
bool
{
func
(
x
*
StorageS3Config
)
GetAccessKeyId
()
string
{
if
x
!=
nil
{
return
x
.
DisallowPublicVisible
return
x
.
AccessKeyId
}
return
false
return
""
}
func
(
x
*
WorkspaceMemoRelatedSetting
)
GetDisplayWithUpdateTime
()
bool
{
func
(
x
*
StorageS3Config
)
GetAccessKeySecret
()
string
{
if
x
!=
nil
{
return
x
.
DisplayWithUpdateTime
return
x
.
AccessKeySecret
}
return
false
return
""
}
func
(
x
*
WorkspaceMemoRelatedSetting
)
GetContentLengthLimit
()
int32
{
func
(
x
*
StorageS3Config
)
GetEndpoint
()
string
{
if
x
!=
nil
{
return
x
.
ContentLengthLimi
t
return
x
.
Endpoin
t
}
return
0
return
""
}
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
type
WorkspaceStorageSetting_S3Config
struct
{
func
(
x
*
StorageS3Config
)
GetRegion
()
string
{
if
x
!=
nil
{
return
x
.
Region
}
return
""
}
func
(
x
*
StorageS3Config
)
GetBucket
()
string
{
if
x
!=
nil
{
return
x
.
Bucket
}
return
""
}
type
WorkspaceMemoRelatedSetting
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
AccessKeyId
string
`protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
AccessKeySecret
string
`protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
Endpoint
string
`protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
Region
string
`protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
Bucket
string
`protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
// disallow_public_share disallows set memo as public visible.
DisallowPublicVisible
bool
`protobuf:"varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3" json:"disallow_public_visible,omitempty"`
// display_with_update_time orders and displays memo with update time.
DisplayWithUpdateTime
bool
`protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
// content_length_limit is the limit of content length. Unit is byte.
ContentLengthLimit
int32
`protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
}
func
(
x
*
Workspace
StorageSetting_S3Confi
g
)
Reset
()
{
*
x
=
Workspace
StorageSetting_S3Confi
g
{}
func
(
x
*
Workspace
MemoRelatedSettin
g
)
Reset
()
{
*
x
=
Workspace
MemoRelatedSettin
g
{}
if
protoimpl
.
UnsafeEnabled
{
mi
:=
&
file_store_workspace_setting_proto_msgTypes
[
6
]
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -634,13 +648,13 @@ func (x *WorkspaceStorageSetting_S3Config) Reset() {
}
}
func
(
x
*
Workspace
StorageSetting_S3Confi
g
)
String
()
string
{
func
(
x
*
Workspace
MemoRelatedSettin
g
)
String
()
string
{
return
protoimpl
.
X
.
MessageStringOf
(
x
)
}
func
(
*
Workspace
StorageSetting_S3Confi
g
)
ProtoMessage
()
{}
func
(
*
Workspace
MemoRelatedSettin
g
)
ProtoMessage
()
{}
func
(
x
*
Workspace
StorageSetting_S3Confi
g
)
ProtoReflect
()
protoreflect
.
Message
{
func
(
x
*
Workspace
MemoRelatedSettin
g
)
ProtoReflect
()
protoreflect
.
Message
{
mi
:=
&
file_store_workspace_setting_proto_msgTypes
[
6
]
if
protoimpl
.
UnsafeEnabled
&&
x
!=
nil
{
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -652,44 +666,30 @@ func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
return
mi
.
MessageOf
(
x
)
}
// Deprecated: Use WorkspaceStorageSetting_S3Config.ProtoReflect.Descriptor instead.
func
(
*
WorkspaceStorageSetting_S3Config
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_store_workspace_setting_proto_rawDescGZIP
(),
[]
int
{
4
,
0
}
}
func
(
x
*
WorkspaceStorageSetting_S3Config
)
GetAccessKeyId
()
string
{
if
x
!=
nil
{
return
x
.
AccessKeyId
}
return
""
}
func
(
x
*
WorkspaceStorageSetting_S3Config
)
GetAccessKeySecret
()
string
{
if
x
!=
nil
{
return
x
.
AccessKeySecret
}
return
""
// Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead.
func
(
*
WorkspaceMemoRelatedSetting
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_store_workspace_setting_proto_rawDescGZIP
(),
[]
int
{
6
}
}
func
(
x
*
Workspace
StorageSetting_S3Config
)
GetEndpoint
()
string
{
func
(
x
*
Workspace
MemoRelatedSetting
)
GetDisallowPublicVisible
()
bool
{
if
x
!=
nil
{
return
x
.
Endpoint
return
x
.
DisallowPublicVisible
}
return
""
return
false
}
func
(
x
*
Workspace
StorageSetting_S3Config
)
GetRegion
()
string
{
func
(
x
*
Workspace
MemoRelatedSetting
)
GetDisplayWithUpdateTime
()
bool
{
if
x
!=
nil
{
return
x
.
Region
return
x
.
DisplayWithUpdateTime
}
return
""
return
false
}
func
(
x
*
Workspace
StorageSetting_S3Config
)
GetBucket
()
string
{
func
(
x
*
Workspace
MemoRelatedSetting
)
GetContentLengthLimit
()
int32
{
if
x
!=
nil
{
return
x
.
Bucke
t
return
x
.
ContentLengthLimi
t
}
return
""
return
0
}
var
File_store_workspace_setting_proto
protoreflect
.
FileDescriptor
...
...
@@ -757,7 +757,7 @@ var file_store_workspace_setting_proto_rawDesc = []byte{
0x55
,
0x72
,
0x6c
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x6c
,
0x6f
,
0x63
,
0x61
,
0x6c
,
0x65
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x6c
,
0x6f
,
0x63
,
0x61
,
0x6c
,
0x65
,
0x12
,
0x1e
,
0x0a
,
0x0a
,
0x61
,
0x70
,
0x70
,
0x65
,
0x61
,
0x72
,
0x61
,
0x6e
,
0x63
,
0x65
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0a
,
0x61
,
0x70
,
0x70
,
0x65
,
0x61
,
0x72
,
0x61
,
0x6e
,
0x63
,
0x65
,
0x22
,
0x
8f
,
0x04
,
0x0a
,
0x17
,
0x0a
,
0x61
,
0x70
,
0x70
,
0x65
,
0x61
,
0x72
,
0x61
,
0x6e
,
0x63
,
0x65
,
0x22
,
0x
d5
,
0x02
,
0x0a
,
0x17
,
0x57
,
0x6f
,
0x72
,
0x6b
,
0x73
,
0x70
,
0x61
,
0x63
,
0x65
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x53
,
0x65
,
0x74
,
0x74
,
0x69
,
0x6e
,
0x67
,
0x12
,
0x53
,
0x0a
,
0x0c
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x5f
,
0x74
,
0x79
,
0x70
,
0x65
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x0e
,
0x32
,
0x30
,
0x2e
,
...
...
@@ -770,57 +770,57 @@ var file_store_workspace_setting_proto_rawDesc = []byte{
0x68
,
0x54
,
0x65
,
0x6d
,
0x70
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x12
,
0x2f
,
0x0a
,
0x14
,
0x75
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x5f
,
0x73
,
0x69
,
0x7a
,
0x65
,
0x5f
,
0x6c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x5f
,
0x6d
,
0x62
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x03
,
0x52
,
0x11
,
0x75
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x53
,
0x69
,
0x7a
,
0x65
,
0x4c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x4d
,
0x62
,
0x12
,
0x
4a
,
0x0a
,
0x09
,
0x73
,
0x33
,
0x5f
,
0x63
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x
2d
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x2e
,
0x5
7
,
0x6f
,
0x72
,
0x6b
,
0x
73
,
0x70
,
0x61
,
0x63
,
0x65
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x53
,
0x65
,
0x74
,
0x74
,
0x6
9
,
0x6e
,
0x67
,
0x2e
,
0x53
,
0x33
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x52
,
0x08
,
0x73
,
0x33
,
0x
43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x1a
,
0xa6
,
0x01
,
0x0a
,
0x08
,
0x53
,
0x33
,
0x43
,
0x6f
,
0x6e
,
0x
66
,
0x69
,
0x67
,
0x12
,
0x22
,
0x0a
,
0x0d
,
0x61
,
0x63
,
0x63
,
0x65
,
0x73
,
0x73
,
0x5f
,
0x6b
,
0x65
,
0x
79
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0b
,
0x61
,
0x63
,
0x63
,
0x65
,
0x
73
,
0x73
,
0x4b
,
0x65
,
0x79
,
0x49
,
0x64
,
0x12
,
0x2a
,
0x0a
,
0x11
,
0x61
,
0x63
,
0x63
,
0x65
,
0x7
3
,
0x
73
,
0x5f
,
0x6b
,
0x65
,
0x79
,
0x5f
,
0x73
,
0x65
,
0x63
,
0x72
,
0x65
,
0x74
,
0x18
,
0x02
,
0x20
,
0x01
,
0x
28
,
0x09
,
0x52
,
0x0f
,
0x61
,
0x63
,
0x63
,
0x65
,
0x73
,
0x73
,
0x4b
,
0x65
,
0x79
,
0x53
,
0x65
,
0x6
3
,
0x7
2
,
0x65
,
0x74
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x65
,
0x6e
,
0x64
,
0x70
,
0x6f
,
0x69
,
0x6e
,
0x74
,
0x18
,
0x
03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x65
,
0x6e
,
0x64
,
0x70
,
0x6f
,
0x69
,
0x6e
,
0x74
,
0x12
,
0x
16
,
0x0a
,
0x06
,
0x72
,
0x65
,
0x67
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x
06
,
0x72
,
0x65
,
0x67
,
0x69
,
0x6f
,
0x6e
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x62
,
0x75
,
0x63
,
0x6
b
,
0x65
,
0x7
4
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x62
,
0x75
,
0x63
,
0x6b
,
0x65
,
0x74
,
0x22
,
0x
4c
,
0x0a
,
0x0b
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x54
,
0x79
,
0x70
,
0x65
,
0x12
,
0x1c
,
0x
0a
,
0x18
,
0x53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x45
,
0x5f
,
0x54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x55
,
0x
4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x0c
,
0x0a
,
0x08
,
0x
44
,
0x41
,
0x54
,
0x41
,
0x42
,
0x41
,
0x53
,
0x45
,
0x10
,
0x01
,
0x12
,
0x09
,
0x0a
,
0x05
,
0x4c
,
0x4f
,
0x
43
,
0x41
,
0x4c
,
0x10
,
0x02
,
0x12
,
0x06
,
0x0a
,
0x02
,
0x53
,
0x33
,
0x10
,
0x03
,
0x22
,
0xc0
,
0x01
,
0x
0a
,
0x1b
,
0x57
,
0x6f
,
0x72
,
0x6b
,
0x73
,
0x70
,
0x61
,
0x63
,
0x65
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x6
5
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x64
,
0x53
,
0x65
,
0x74
,
0x74
,
0x69
,
0x6e
,
0x67
,
0x12
,
0x36
,
0x0a
,
0x
17
,
0x64
,
0x69
,
0x73
,
0x61
,
0x6c
,
0x6c
,
0x6f
,
0x77
,
0x5f
,
0x70
,
0x75
,
0x62
,
0x6c
,
0x69
,
0x63
,
0x
5f
,
0x76
,
0x69
,
0x73
,
0x69
,
0x62
,
0x6c
,
0x65
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x1
5
,
0x6
4
,
0x69
,
0x73
,
0x61
,
0x6c
,
0x6c
,
0x6f
,
0x77
,
0x50
,
0x75
,
0x62
,
0x6c
,
0x69
,
0x63
,
0x56
,
0x69
,
0x
73
,
0x69
,
0x62
,
0x6c
,
0x65
,
0x12
,
0x37
,
0x0a
,
0x18
,
0x64
,
0x69
,
0x73
,
0x70
,
0x6c
,
0x61
,
0x79
,
0x
5f
,
0x77
,
0x69
,
0x74
,
0x68
,
0x5f
,
0x75
,
0x70
,
0x64
,
0x61
,
0x74
,
0x65
,
0x5f
,
0x74
,
0x69
,
0x6d
,
0x6
5
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x15
,
0x64
,
0x69
,
0x73
,
0x70
,
0x6c
,
0x61
,
0x79
,
0x5
7
,
0x69
,
0x74
,
0x68
,
0x55
,
0x70
,
0x64
,
0x61
,
0x74
,
0x65
,
0x54
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x30
,
0x
0a
,
0x14
,
0x63
,
0x6f
,
0x6e
,
0x74
,
0x65
,
0x6e
,
0x74
,
0x5f
,
0x6c
,
0x65
,
0x6e
,
0x67
,
0x74
,
0x68
,
0x
5f
,
0x6c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x12
,
0x63
,
0x6f
,
0x6
e
,
0x74
,
0x65
,
0x6e
,
0x74
,
0x4c
,
0x65
,
0x6e
,
0x67
,
0x74
,
0x68
,
0x4c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x
2a
,
0x73
,
0x0a
,
0x13
,
0x57
,
0x6f
,
0x72
,
0x6b
,
0x73
,
0x70
,
0x61
,
0x63
,
0x65
,
0x53
,
0x65
,
0x74
,
0x
74
,
0x69
,
0x6e
,
0x67
,
0x4b
,
0x65
,
0x79
,
0x12
,
0x25
,
0x0a
,
0x21
,
0x57
,
0x4f
,
0x52
,
0x4b
,
0x53
,
0x
50
,
0x41
,
0x43
,
0x45
,
0x5f
,
0x53
,
0x45
,
0x54
,
0x54
,
0x49
,
0x4e
,
0x47
,
0x5f
,
0x4b
,
0x45
,
0x5
9
,
0x
5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x09
,
0x0
a
,
0x05
,
0x42
,
0x41
,
0x53
,
0x49
,
0x43
,
0x10
,
0x01
,
0x12
,
0x0b
,
0x0a
,
0x07
,
0x47
,
0x45
,
0x4e
,
0x
45
,
0x52
,
0x41
,
0x4c
,
0x10
,
0x02
,
0x12
,
0x0b
,
0x0a
,
0x07
,
0x53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x4
5
,
0x10
,
0x03
,
0x12
,
0x10
,
0x0a
,
0x0c
,
0x4d
,
0x45
,
0x4d
,
0x4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
0xea
,
0x02
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x7
3
,
0x3a
,
0x3a
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x62
,
0x06
,
0x7
0
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
0x69
,
0x7a
,
0x65
,
0x4c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x4d
,
0x62
,
0x12
,
0x
39
,
0x0a
,
0x09
,
0x73
,
0x33
,
0x5f
,
0x63
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0b
,
0x32
,
0x
1c
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x73
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x2e
,
0x5
3
,
0x74
,
0x6f
,
0x72
,
0x
61
,
0x67
,
0x65
,
0x53
,
0x33
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x52
,
0x08
,
0x73
,
0x33
,
0x43
,
0x6
f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x22
,
0x4c
,
0x0a
,
0x0b
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x
54
,
0x79
,
0x70
,
0x65
,
0x12
,
0x1c
,
0x0a
,
0x18
,
0x53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x45
,
0x5f
,
0x
54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x
10
,
0x00
,
0x12
,
0x0c
,
0x0a
,
0x08
,
0x44
,
0x41
,
0x54
,
0x41
,
0x42
,
0x41
,
0x53
,
0x45
,
0x10
,
0x01
,
0x
12
,
0x09
,
0x0a
,
0x05
,
0x4c
,
0x4f
,
0x43
,
0x41
,
0x4c
,
0x10
,
0x02
,
0x12
,
0x06
,
0x0a
,
0x02
,
0x5
3
,
0x
33
,
0x10
,
0x03
,
0x22
,
0xad
,
0x01
,
0x0a
,
0x0f
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x61
,
0x67
,
0x65
,
0x53
,
0x
33
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x12
,
0x22
,
0x0a
,
0x0d
,
0x61
,
0x63
,
0x63
,
0x65
,
0x7
3
,
0x7
3
,
0x5f
,
0x6b
,
0x65
,
0x79
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0b
,
0x
61
,
0x63
,
0x63
,
0x65
,
0x73
,
0x73
,
0x4b
,
0x65
,
0x79
,
0x49
,
0x64
,
0x12
,
0x2a
,
0x0a
,
0x11
,
0x61
,
0x
63
,
0x63
,
0x65
,
0x73
,
0x73
,
0x5f
,
0x6b
,
0x65
,
0x79
,
0x5f
,
0x73
,
0x65
,
0x63
,
0x72
,
0x65
,
0x74
,
0x
18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0f
,
0x61
,
0x63
,
0x63
,
0x65
,
0x73
,
0x73
,
0x4
b
,
0x65
,
0x7
9
,
0x53
,
0x65
,
0x63
,
0x72
,
0x65
,
0x74
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x65
,
0x6e
,
0x64
,
0x70
,
0x6f
,
0x
69
,
0x6e
,
0x74
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x08
,
0x65
,
0x6e
,
0x64
,
0x70
,
0x6f
,
0x
69
,
0x6e
,
0x74
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x72
,
0x65
,
0x67
,
0x69
,
0x6f
,
0x6e
,
0x18
,
0x04
,
0x20
,
0x
01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x72
,
0x65
,
0x67
,
0x69
,
0x6f
,
0x6e
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x62
,
0x
75
,
0x63
,
0x6b
,
0x65
,
0x74
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x62
,
0x75
,
0x63
,
0x
6b
,
0x65
,
0x74
,
0x22
,
0xc0
,
0x01
,
0x0a
,
0x1b
,
0x57
,
0x6f
,
0x72
,
0x6b
,
0x73
,
0x70
,
0x61
,
0x63
,
0x
65
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x64
,
0x53
,
0x65
,
0x74
,
0x74
,
0x6
9
,
0x6e
,
0x67
,
0x12
,
0x36
,
0x0a
,
0x17
,
0x64
,
0x69
,
0x73
,
0x61
,
0x6c
,
0x6c
,
0x6f
,
0x77
,
0x5f
,
0x
70
,
0x75
,
0x62
,
0x6c
,
0x69
,
0x63
,
0x5f
,
0x76
,
0x69
,
0x73
,
0x69
,
0x62
,
0x6c
,
0x65
,
0x18
,
0x01
,
0x
20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x15
,
0x64
,
0x69
,
0x73
,
0x61
,
0x6c
,
0x6c
,
0x6f
,
0x77
,
0x50
,
0x7
5
,
0x6
2
,
0x6c
,
0x69
,
0x63
,
0x56
,
0x69
,
0x73
,
0x69
,
0x62
,
0x6c
,
0x65
,
0x12
,
0x37
,
0x0a
,
0x18
,
0x64
,
0x
69
,
0x73
,
0x70
,
0x6c
,
0x61
,
0x79
,
0x5f
,
0x77
,
0x69
,
0x74
,
0x68
,
0x5f
,
0x75
,
0x70
,
0x64
,
0x61
,
0x
74
,
0x65
,
0x5f
,
0x74
,
0x69
,
0x6d
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x08
,
0x52
,
0x15
,
0x64
,
0x6
9
,
0x73
,
0x70
,
0x6c
,
0x61
,
0x79
,
0x57
,
0x69
,
0x74
,
0x68
,
0x55
,
0x70
,
0x64
,
0x61
,
0x74
,
0x65
,
0x5
4
,
0x69
,
0x6d
,
0x65
,
0x12
,
0x30
,
0x0a
,
0x14
,
0x63
,
0x6f
,
0x6e
,
0x74
,
0x65
,
0x6e
,
0x74
,
0x5f
,
0x
6c
,
0x65
,
0x6e
,
0x67
,
0x74
,
0x68
,
0x5f
,
0x6c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x18
,
0x03
,
0x20
,
0x01
,
0x
28
,
0x05
,
0x52
,
0x12
,
0x63
,
0x6f
,
0x6e
,
0x74
,
0x65
,
0x6e
,
0x74
,
0x4c
,
0x65
,
0x6e
,
0x67
,
0x74
,
0x6
8
,
0x4c
,
0x69
,
0x6d
,
0x69
,
0x74
,
0x2a
,
0x73
,
0x0a
,
0x13
,
0x57
,
0x6f
,
0x72
,
0x6b
,
0x73
,
0x70
,
0x
61
,
0x63
,
0x65
,
0x53
,
0x65
,
0x74
,
0x74
,
0x69
,
0x6e
,
0x67
,
0x4b
,
0x65
,
0x79
,
0x12
,
0x25
,
0x0a
,
0x
21
,
0x57
,
0x4f
,
0x52
,
0x4b
,
0x53
,
0x50
,
0x41
,
0x43
,
0x45
,
0x5f
,
0x53
,
0x45
,
0x54
,
0x54
,
0x49
,
0x
4e
,
0x47
,
0x5f
,
0x4b
,
0x45
,
0x59
,
0x5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x4
9
,
0x
45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x09
,
0x0a
,
0x05
,
0x42
,
0x41
,
0x53
,
0x49
,
0x43
,
0x10
,
0x01
,
0x12
,
0x0
b
,
0x0a
,
0x07
,
0x47
,
0x45
,
0x4e
,
0x45
,
0x52
,
0x41
,
0x4c
,
0x10
,
0x02
,
0x12
,
0x0b
,
0x0a
,
0x07
,
0x
53
,
0x54
,
0x4f
,
0x52
,
0x41
,
0x47
,
0x45
,
0x10
,
0x03
,
0x12
,
0x10
,
0x0a
,
0x0c
,
0x4d
,
0x45
,
0x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
,
0x61
,
0xea
,
0x
02
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x3a
,
0x3a
,
0x53
,
0x74
,
0x6f
,
0x72
,
0x65
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
var
(
...
...
@@ -845,18 +845,18 @@ var file_store_workspace_setting_proto_goTypes = []interface{}{
(
*
WorkspaceGeneralSetting
)(
nil
),
// 4: memos.store.WorkspaceGeneralSetting
(
*
WorkspaceCustomProfile
)(
nil
),
// 5: memos.store.WorkspaceCustomProfile
(
*
WorkspaceStorageSetting
)(
nil
),
// 6: memos.store.WorkspaceStorageSetting
(
*
WorkspaceMemoRelatedSetting
)(
nil
),
// 7: memos.store.WorkspaceMemoRelatedSettin
g
(
*
Workspace
StorageSetting_S3Config
)(
nil
),
// 8: memos.store.WorkspaceStorageSetting.S3Confi
g
(
*
StorageS3Config
)(
nil
),
// 7: memos.store.StorageS3Confi
g
(
*
Workspace
MemoRelatedSetting
)(
nil
),
// 8: memos.store.WorkspaceMemoRelatedSettin
g
}
var
file_store_workspace_setting_proto_depIdxs
=
[]
int32
{
0
,
// 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey
3
,
// 1: memos.store.WorkspaceSetting.basic_setting:type_name -> memos.store.WorkspaceBasicSetting
4
,
// 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting
6
,
// 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting
7
,
// 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting
8
,
// 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting
5
,
// 5: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile
1
,
// 6: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType
8
,
// 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.WorkspaceStorageSetting.
S3Config
7
,
// 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.Storage
S3Config
8
,
// [8:8] is the sub-list for method output_type
8
,
// [8:8] is the sub-list for method input_type
8
,
// [8:8] is the sub-list for extension type_name
...
...
@@ -931,7 +931,7 @@ func file_store_workspace_setting_proto_init() {
}
}
file_store_workspace_setting_proto_msgTypes
[
5
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
WorkspaceMemoRelatedSettin
g
);
i
{
switch
v
:=
v
.
(
*
StorageS3Confi
g
);
i
{
case
0
:
return
&
v
.
state
case
1
:
...
...
@@ -943,7 +943,7 @@ func file_store_workspace_setting_proto_init() {
}
}
file_store_workspace_setting_proto_msgTypes
[
6
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
Workspace
StorageSetting_S3Confi
g
);
i
{
switch
v
:=
v
.
(
*
Workspace
MemoRelatedSettin
g
);
i
{
case
0
:
return
&
v
.
state
case
1
:
...
...
proto/store/resource.proto
View file @
b0aad6f6
...
...
@@ -3,6 +3,7 @@ syntax = "proto3";
package
memos
.
store
;
import
"google/protobuf/timestamp.proto"
;
import
"store/workspace_setting.proto"
;
option
go_package
=
"gen/store"
;
...
...
@@ -19,10 +20,11 @@ message ResourcePayload {
}
message
S3Object
{
StorageS3Config
s3_config
=
1
;
// key is the S3 object key.
string
key
=
1
;
string
key
=
2
;
// last_presigned_time is the last time the object was presigned.
// This is used to determine if the presigned URL is still valid.
google.protobuf.Timestamp
last_presigned_time
=
2
;
google.protobuf.Timestamp
last_presigned_time
=
3
;
}
}
proto/store/workspace_setting.proto
View file @
b0aad6f6
...
...
@@ -70,16 +70,17 @@ message WorkspaceStorageSetting {
string
filepath_template
=
2
;
// The max upload size in megabytes.
int64
upload_size_limit_mb
=
3
;
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
message
S3Config
{
string
access_key_id
=
1
;
string
access_key_secret
=
2
;
string
endpoint
=
3
;
string
region
=
4
;
string
bucket
=
5
;
}
// The S3 config.
S3Config
s3_config
=
4
;
StorageS3Config
s3_config
=
4
;
}
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
message
StorageS3Config
{
string
access_key_id
=
1
;
string
access_key_secret
=
2
;
string
endpoint
=
3
;
string
region
=
4
;
string
bucket
=
5
;
}
message
WorkspaceMemoRelatedSetting
{
...
...
server/router/api/v1/memo_service.go
View file @
b0aad6f6
...
...
@@ -93,7 +93,7 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq
ExcludeComments
:
true
,
}
if
err
:=
s
.
buildMemoFindWithFilter
(
ctx
,
memoFind
,
request
.
Filter
);
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"failed to build find memos with filter
"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"failed to build find memos with filter
: %v"
,
err
)
}
var
limit
,
offset
int
...
...
@@ -151,12 +151,12 @@ func (s *APIV1Service) SearchMemos(ctx context.Context, request *v1pb.SearchMemo
}
err
:=
s
.
buildMemoFindWithFilter
(
ctx
,
memoFind
,
request
.
Filter
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"failed to build find memos with filter
"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"failed to build find memos with filter
: %v"
,
err
)
}
memos
,
err
:=
s
.
Store
.
ListMemos
(
ctx
,
memoFind
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to search memos
"
)
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to search memos
: %v"
,
err
)
}
memoMessages
:=
[]
*
v1pb
.
Memo
{}
...
...
@@ -519,7 +519,7 @@ func (s *APIV1Service) ExportMemos(ctx context.Context, request *v1pb.ExportMemo
ExcludeComments
:
true
,
}
if
err
:=
s
.
buildMemoFindWithFilter
(
ctx
,
memoFind
,
request
.
Filter
);
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
In
ternal
,
"failed to build find memos with filter: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
In
validArgument
,
"failed to build find memos with filter: %v"
,
err
)
}
memos
,
err
:=
s
.
Store
.
ListMemos
(
ctx
,
memoFind
)
...
...
@@ -610,7 +610,7 @@ func (s *APIV1Service) ListMemoTags(ctx context.Context, request *v1pb.ListMemoT
memoFind
.
ID
=
&
memoID
}
if
err
:=
s
.
buildMemoFindWithFilter
(
ctx
,
memoFind
,
request
.
Filter
);
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
In
ternal
,
"failed to build find memos with filter: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
In
validArgument
,
"failed to build find memos with filter: %v"
,
err
)
}
memos
,
err
:=
s
.
Store
.
ListMemos
(
ctx
,
memoFind
)
...
...
server/router/api/v1/resource_service.go
View file @
b0aad6f6
...
...
@@ -373,6 +373,7 @@ func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resourc
create
.
Payload
=
&
storepb
.
ResourcePayload
{
Payload
:
&
storepb
.
ResourcePayload_S3Object_
{
S3Object
:
&
storepb
.
ResourcePayload_S3Object
{
S3Config
:
s3Config
,
Key
:
key
,
LastPresignedTime
:
timestamppb
.
New
(
time
.
Now
()),
},
...
...
server/router/api/v1/workspace_setting_service.go
View file @
b0aad6f6
...
...
@@ -193,7 +193,7 @@ func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceStorageSetting
UploadSizeLimitMb
:
setting
.
UploadSizeLimitMb
,
}
if
setting
.
S3Config
!=
nil
{
settingpb
.
S3Config
=
&
storepb
.
WorkspaceStorageSetting_
S3Config
{
settingpb
.
S3Config
=
&
storepb
.
Storage
S3Config
{
AccessKeyId
:
setting
.
S3Config
.
AccessKeyId
,
AccessKeySecret
:
setting
.
S3Config
.
AccessKeySecret
,
Endpoint
:
setting
.
S3Config
.
Endpoint
,
...
...
server/service/s3_object_presigner/s3_object_presigner.go
View file @
b0aad6f6
...
...
@@ -2,6 +2,7 @@ package s3objectpresigner
import
(
"context"
"log/slog"
"time"
"google.golang.org/protobuf/types/known/timestamppb"
...
...
@@ -28,15 +29,6 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
return
}
s3Config
:=
workspaceStorageSetting
.
GetS3Config
()
if
s3Config
==
nil
{
return
}
s3Client
,
err
:=
s3
.
NewClient
(
ctx
,
s3Config
)
if
err
!=
nil
{
return
}
s3StorageType
:=
storepb
.
ResourceStorageType_S3
resources
,
err
:=
p
.
Store
.
ListResources
(
ctx
,
&
store
.
FindResource
{
GetBlob
:
false
,
...
...
@@ -59,10 +51,27 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
continue
}
}
s3Config
:=
workspaceStorageSetting
.
GetS3Config
()
if
s3ObjectPayload
.
S3Config
!=
nil
{
s3Config
=
s3ObjectPayload
.
S3Config
}
if
s3Config
==
nil
{
slog
.
Error
(
"S3 config is not found"
)
continue
}
s3Client
,
err
:=
s3
.
NewClient
(
ctx
,
s3Config
)
if
err
!=
nil
{
slog
.
Error
(
"Failed to create S3 client"
,
slog
.
Any
(
"err"
,
err
))
continue
}
presignURL
,
err
:=
s3Client
.
PresignGetObject
(
ctx
,
s3ObjectPayload
.
Key
)
if
err
!=
nil
{
return
}
s3ObjectPayload
.
S3Config
=
s3Config
s3ObjectPayload
.
LastPresignedTime
=
timestamppb
.
New
(
time
.
Now
())
if
err
:=
p
.
Store
.
UpdateResource
(
ctx
,
&
store
.
UpdateResource
{
Reference
:
&
presignURL
,
...
...
store/resource.go
View file @
b0aad6f6
...
...
@@ -129,10 +129,14 @@ func (s *Store) DeleteResource(ctx context.Context, delete *DeleteResource) erro
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to get workspace storage setting"
)
}
s3Config
:=
workspaceStorageSetting
.
S3Config
s3Config
:=
s3ObjectPayload
.
S3Config
if
s3Config
==
nil
{
return
errors
.
Errorf
(
"No actived external storage found"
)
if
workspaceStorageSetting
.
S3Config
==
nil
{
return
errors
.
Errorf
(
"S3 config is not found"
)
}
s3Config
=
workspaceStorageSetting
.
S3Config
}
s3Client
,
err
:=
s3
.
NewClient
(
ctx
,
s3Config
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"Failed to create s3 client"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment