Refactor storage interface to return io.Reader and Writer instances
Doing so will enable encrypting/decrypting files in a 'pipeline' without having to write the intermediate results to a file or store them in their entirety in memory. This commit also updates the existing storage classes (local and FTP) to meet the new interface definition.
This commit is contained in:
@ -7,11 +7,14 @@ package main
|
||||
import (
|
||||
"code.google.com/p/goconf/conf"
|
||||
"errors"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Storage interface {
|
||||
Put(filename string, hash string) error
|
||||
Get(filename string, hash string) error
|
||||
// Close() MUST be called on the returned io.WriteCloser
|
||||
Put(hash string) (io.WriteCloser, error)
|
||||
// Close() MUST be called on the returned io.ReadCloser
|
||||
Get(hash string) (io.ReadCloser, error)
|
||||
}
|
||||
|
||||
func GetStorage(config *conf.ConfigFile) (Storage, error) {
|
||||
|
Reference in New Issue
Block a user