You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
70 lines
1.8 KiB
10 years ago
|
/*
|
||
|
* Minimalist Object Storage, (C) 2015 Minio, Inc.
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
package donut
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
// Encoder interface
|
||
|
type Encoder interface {
|
||
|
GetEncodedBlockLen(dataLength int) (int, error)
|
||
|
Encode(data []byte) (encodedData [][]byte, err error)
|
||
|
Decode(encodedData [][]byte, dataLength int) (data []byte, err error)
|
||
|
}
|
||
|
|
||
|
// Bucket interface
|
||
|
type Bucket interface {
|
||
|
ListObjects() (map[string]Object, error)
|
||
|
|
||
|
GetObject(object string) (io.ReadCloser, int64, error)
|
||
10 years ago
|
PutObject(object string, contents io.Reader, expectedMD5Sum string, metadata map[string]string) error
|
||
10 years ago
|
}
|
||
|
|
||
|
// Object interface
|
||
|
type Object interface {
|
||
|
GetObjectMetadata() (map[string]string, error)
|
||
10 years ago
|
GetDonutObjectMetadata() (map[string]string, error)
|
||
10 years ago
|
}
|
||
|
|
||
|
// Node interface
|
||
|
type Node interface {
|
||
|
ListDisks() (map[string]Disk, error)
|
||
|
AttachDisk(disk Disk) error
|
||
|
DetachDisk(disk Disk) error
|
||
|
|
||
|
GetNodeName() string
|
||
|
SaveConfig() error
|
||
|
LoadConfig() error
|
||
|
}
|
||
|
|
||
|
// Disk interface
|
||
|
type Disk interface {
|
||
|
MakeDir(dirname string) error
|
||
|
|
||
|
ListDir(dirname string) ([]os.FileInfo, error)
|
||
|
ListFiles(dirname string) ([]os.FileInfo, error)
|
||
|
|
||
|
MakeFile(path string) (*os.File, error)
|
||
|
OpenFile(path string) (*os.File, error)
|
||
|
|
||
|
GetPath() string
|
||
|
GetOrder() int
|
||
|
GetFSInfo() map[string]string
|
||
|
}
|