Add fs prefix (directory)
This ensures the fs root is clean and does not mess with the metadata. Also in the future this will allow for multiple filesystems to be created in one bucket.
This commit is contained in:
parent
e995487c45
commit
2341274393
6 changed files with 31 additions and 8 deletions
pkg/s3
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
const (
|
||||
metadataName = ".metadata.json"
|
||||
fsPrefix = "csi-fs"
|
||||
)
|
||||
|
||||
type s3Client struct {
|
||||
|
@ -22,6 +23,7 @@ type s3Client struct {
|
|||
|
||||
type bucket struct {
|
||||
Name string
|
||||
FSPath string
|
||||
CapacityBytes int64
|
||||
}
|
||||
|
||||
|
@ -54,6 +56,14 @@ func (client *s3Client) createBucket(bucketName string) error {
|
|||
return client.minio.MakeBucket(bucketName, client.cfg.Region)
|
||||
}
|
||||
|
||||
func (client *s3Client) createPrefix(bucketName string, prefix string) error {
|
||||
_, err := client.minio.PutObject(bucketName, prefix+"/", bytes.NewReader([]byte("")), 0, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (client *s3Client) removeBucket(bucketName string) error {
|
||||
if err := client.emptyBucket(bucketName); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue