Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

Updating code to reflect changes in chainstore. #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Glockfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ github.com/goware/urlx 6292537e62efc11517f237ed166bd105c6b44aa8
github.com/mitchellh/goamz caaaea8b30ee15616494ee68abd5d8ebbbef05cf
github.com/opennota/urlesc 5fa9ff0392746aeae1c4b37fcc42c65afa7a9587
github.com/pmezard/go-difflib d8ed2627bdf02c080bf22230dbb337003b7aba2d
github.com/pressly/chainstore 907f0f81699a835e86a81f11a3d3cd4d7215c360
github.com/pressly/chainstore 63215bf46a6b470683ec038aea7e503281af5647
github.com/pressly/chi 9c95d30f0c46f408acf781e52ecf6a15c2323a15
github.com/pressly/consistentrd 43f3d1020fc03cf1271313ec9b95c8a967c0b878
github.com/rs/cors eb527c8097e0f19a3ff7b253a3fe70545070f420
Expand Down
9 changes: 3 additions & 6 deletions server/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ func (b *Bucket) DbFindImage(ctx context.Context, key string, optSizing ...*imgr
return nil, ErrImageNotFound
}

// data, err := app.Chainstore.Get(context.Background(), idxKey) // TODO
data, err := app.Chainstore.Get(idxKey) // TODO
data, err := app.Chainstore.Get(context.Background(), idxKey)
if err != nil {
return nil, err
}
Expand All @@ -186,8 +185,7 @@ func (b *Bucket) DbSaveImage(ctx context.Context, im *Image, sizing *imgry.Sizin

idxKey := b.DbIndexKey(im.Key, sizing)

// err = app.Chainstore.Put(context.Background(), idxKey, im.Data) // TODO
err = app.Chainstore.Put(idxKey, im.Data)
err = app.Chainstore.Put(context.Background(), idxKey, im.Data)
if err != nil {
return
}
Expand All @@ -204,8 +202,7 @@ func (b *Bucket) DbDelImage(ctx context.Context, key string) (err error) {
return
}

// err = app.Chainstore.Del(context.Background(), idxKey) // + "*") // TODO
err = app.Chainstore.Del(idxKey)
err = app.Chainstore.Del(context.Background(), idxKey)
return
}

Expand Down
26 changes: 11 additions & 15 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/pressly/chainstore/boltstore"
"github.com/pressly/chainstore/lrumgr"
"github.com/pressly/chainstore/memstore"
"github.com/pressly/chainstore/metricsmgr"
"github.com/pressly/chainstore/s3store"
)

Expand Down Expand Up @@ -191,27 +192,22 @@ func (cf *Config) GetChainstore() (chainstore.Store, error) {
// the bolt data..

// Build the stores and setup the chain
// memStore := metricsmgr.New("fn.store.mem", nil,
// memstore.New(cf.Chainstore.MemCacheSize*1024*1024),
// )
memStore := memstore.New(cf.Chainstore.MemCacheSize * 1024 * 1024)

// diskStore := lrumgr.New(cf.Chainstore.DiskCacheSize*1024*1024,
// metricsmgr.New("fn.store.bolt", nil,
// boltstore.New(cf.Chainstore.Path+"store.db", "imgry"),
// ),
// )
memStore := metricsmgr.New("fn.store.mem",
memstore.New(cf.Chainstore.MemCacheSize*1024*1024),
)

diskStore := lrumgr.New(cf.Chainstore.DiskCacheSize*1024*1024,
boltstore.New(cf.Chainstore.Path+"store.db", "imgry"),
metricsmgr.New("fn.store.bolt",
boltstore.New(cf.Chainstore.Path+"store.db", "imgry"),
),
)

var store chainstore.Store

if cf.Chainstore.S3AccessKey != "" && cf.Chainstore.S3SecretKey != "" {
// s3Store := metricsmgr.New("fn.store.s3", nil,
// s3store.New(cf.Chainstore.S3Bucket, cf.Chainstore.S3AccessKey, cf.Chainstore.S3SecretKey),
// )
s3Store := s3store.New(cf.Chainstore.S3Bucket, cf.Chainstore.S3AccessKey, cf.Chainstore.S3SecretKey)
s3Store := metricsmgr.New("fn.store.s3",
s3store.New(cf.Chainstore.S3Bucket, cf.Chainstore.S3AccessKey, cf.Chainstore.S3SecretKey),
)

// store = chainstore.New(memStore, chainstore.Async(diskStore, s3Store))
store = chainstore.New(memStore, chainstore.Async(s3Store))
Expand Down