-
Notifications
You must be signed in to change notification settings - Fork 19
/
cbfs_blobstore.go
49 lines (40 loc) · 1007 Bytes
/
cbfs_blobstore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package elasticthought
import (
"io"
"github.com/couchbaselabs/cbfs/client"
)
type CbfsBlobStore struct {
uri string
*cbfsclient.Client
}
func NewCbfsBlobStore(uri string) (*CbfsBlobStore, error) {
cbfsBlobStore := &CbfsBlobStore{
uri: uri,
}
cbfsClient, err := cbfsclient.New(uri)
if err != nil {
return nil, err
}
cbfsBlobStore.Client = cbfsClient
return cbfsBlobStore, nil
}
func (c *CbfsBlobStore) OpenFile(path string) (BlobHandle, error) {
return c.Client.OpenFile(path)
}
func (c *CbfsBlobStore) Put(srcname, dest string, r io.Reader, opts BlobPutOptions) error {
cbfsPutOptions := opts.PutOptions
return c.Client.Put(srcname, dest, r, cbfsPutOptions)
}
/*
func (c *CbfsBlobStore) OpenFile(path string) (BlobHandle, error) {
cbfsFileHandle, err := c.Client.OpenFile(path)
if err != nil {
return nil, err
}
blobHandle, ok := cbfsFileHandle.(BlobHandle)
if !ok {
return nil, fmt.Errorf("Couldn't convernt cbfs file handle to blob handle")
}
return blobHandle
}
*/