// A Keep "block" is 64MB.
const BLOCKSIZE = 64 * 1024 * 1024
+var BlockNotFound = errors.New("Block not found")
+var InsufficientReplicasError = errors.New("Could not write sufficient replicas")
+
type KeepClient struct {
ApiServer string
ApiToken string
Want_replicas: 2,
Client: &http.Client{Transport: tr}}
- err = (&kc).DiscoverKeepDisks()
+ err = (&kc).DiscoverKeepServers()
return kc, err
}
-func (this *KeepClient) DiscoverKeepDisks() error {
+func (this *KeepClient) DiscoverKeepServers() error {
// Construct request of keep disk list
var req *http.Request
var err error
}
}
-var InsufficientReplicasError = errors.New("Could not write sufficient replicas")
-
func (this KeepClient) putReplicas(
hash string,
requests chan ReadRequest,
}
}
-var BlockNotFound = errors.New("Block not found")
-
func (this KeepClient) Get(hash string) (reader io.ReadCloser,
contentLength int64, url string, err error) {
return this.AuthorizedGet(hash, "", "")
return listener, url
}
-func UploadToStubHelper(c *C, st http.Handler, f func(*KeepClient, string,
+func UploadToStubHelper(c *C, st http.Handler, f func(KeepClient, string,
io.ReadCloser, io.WriteCloser, chan UploadStatus)) {
listener, url := RunBogusKeepServer(st, 2990)
make(chan string)}
UploadToStubHelper(c, st,
- func(kc *KeepClient, url string, reader io.ReadCloser,
+ func(kc KeepClient, url string, reader io.ReadCloser,
writer io.WriteCloser, upload_status chan UploadStatus) {
go kc.uploadToKeepServer(url, st.expectPath, reader, upload_status, int64(len("foo")))
make(chan string)}
UploadToStubHelper(c, st,
- func(kc *KeepClient, url string, reader io.ReadCloser,
+ func(kc KeepClient, url string, reader io.ReadCloser,
writer io.WriteCloser, upload_status chan UploadStatus) {
// Buffer for reads from 'r'
hash := "acbd18db4cc2f85cedef654fccc4a4d8"
UploadToStubHelper(c, st,
- func(kc *KeepClient, url string, reader io.ReadCloser,
+ func(kc KeepClient, url string, reader io.ReadCloser,
writer io.WriteCloser, upload_status chan UploadStatus) {
go kc.uploadToKeepServer(url, hash, reader, upload_status, 3)