MCPcopy Create free account
hub / github.com/apecloud/myduckserver / ConstructStorageConfig

Function ConstructStorageConfig

storage/object_storage.go:128–148  ·  view source on GitHub ↗
(remoteUri, endpoint, accessKeyId, secretAccessKey string)

Source from the content-addressed store, hash-verified

126}
127
128func ConstructStorageConfig(remoteUri, endpoint, accessKeyId, secretAccessKey string) (*ObjectStorageConfig, string, error) {
129 provider, remotePath, err := parseProviderAndPath(remoteUri)
130 if err != nil {
131 return nil, "", fmt.Errorf("failed to parse remote path: %w", err)
132 }
133
134 region, err := parseRegionFromEndpoint(provider, endpoint)
135 if err != nil {
136 return nil, "", fmt.Errorf("failed to parse region from endpoint: %w", err)
137 }
138
139 storageConfig := &ObjectStorageConfig{
140 Provider: provider,
141 Endpoint: endpoint,
142 AccessKeyId: accessKeyId,
143 SecretAccessKey: secretAccessKey,
144 Region: region,
145 }
146
147 return storageConfig, remotePath, nil
148}
149
150func parseBucketAndPath(fullPath string) (string, string) {
151 parts := strings.SplitN(fullPath, "/", 2)

Callers 3

parseRestoreSQLFunction · 0.92
ExecuteRestoreFunction · 0.92
parseBackupSQLFunction · 0.92

Calls 2

parseProviderAndPathFunction · 0.85
parseRegionFromEndpointFunction · 0.85

Tested by

no test coverage detected