Rename index.IndexStorage to index.Storage, to reduce stutter.

Change-Id: I52b2a8460c3957a1c8211a470e1df9a8dc5b7067
This commit is contained in:
Brad Fitzpatrick 2013-01-13 20:19:36 -08:00
parent 2ce7b7f719
commit 75360ee9b3
8 changed files with 16 additions and 18 deletions

2
TODO
View File

@ -1,7 +1,5 @@
-- delete mostly-obsolete camsigd. see big TODO in camsigd.go.
-- rename the index.IndexStorage interface stutter to index.Storage
-- we used to be able live-edit js/css files in server/camlistored/ui when
running under the App Engine dev_appserver.py. That's now broken with my
latest efforts to revive it. The place to start looking is:

View File

@ -16,7 +16,7 @@ limitations under the License.
/*
Package index provides a generic indexing system on top of an abstract
index storage system (IndexStorage).
index storage system (Storage).
The following keys & values are populated by receiving blobs and queried
for search operations:

View File

@ -34,7 +34,7 @@ var _ = log.Printf
var ErrNotFound = errors.New("index: key not found")
type IndexStorage interface {
type Storage interface {
// Get gets the value for the given key. It returns ErrNotFound if the DB
// does not contain the key.
Get(key string) (string, error)
@ -135,7 +135,7 @@ type Index struct {
*blobserver.SimpleBlobHubPartitionMap
*blobserver.NoImplStorage
s IndexStorage
s Storage
KeyFetcher blobref.StreamingFetcher // for verifying claims
@ -147,7 +147,7 @@ type Index struct {
var _ blobserver.Storage = (*Index)(nil)
var _ search.Index = (*Index)(nil)
func New(s IndexStorage) *Index {
func New(s Storage) *Index {
return &Index{
s: s,
SimpleBlobHubPartitionMap: &blobserver.SimpleBlobHubPartitionMap{},
@ -606,4 +606,4 @@ func (x *Index) EdgesTo(ref *blobref.BlobRef, opts *search.EdgesToOpts) (edges [
return edges, nil
}
func (x *Index) Storage() IndexStorage { return x.s }
func (x *Index) Storage() Storage { return x.s }

View File

@ -58,7 +58,7 @@ func newMemoryIndexFromConfig(ld blobserver.Loader, config jsonconfig.Obj) (blob
return ix, err
}
// memKeys is a naive in-memory implementation of IndexStorage for test & development
// memKeys is a naive in-memory implementation of index.Storage for test & development
// purposes only.
type memKeys struct {
mu sync.Mutex // guards db

View File

@ -187,7 +187,7 @@ func (s mongoStrIterator) Close() error {
return nil
}
// Implementation of IndexStorage
// Implementation of index.Storage
type mongoKeys struct {
mu sync.Mutex // guards db
db *mgo.Collection

View File

@ -36,11 +36,11 @@ type myIndexStorage struct {
db *sql.DB
}
var _ index.IndexStorage = (*myIndexStorage)(nil)
var _ index.Storage = (*myIndexStorage)(nil)
// NewStorage returns an IndexStorage implementation of the described MySQL database.
// NewStorage returns an index.Storage implementation of the described MySQL database.
// This exists mostly for testing and does not initialize the schema.
func NewStorage(host, user, password, dbname string) (index.IndexStorage, error) {
func NewStorage(host, user, password, dbname string) (index.Storage, error) {
// TODO(bradfitz): host is ignored; how to plumb it through with mymysql?
dsn := dbname+"/"+user+"/"+password
db, err := sql.Open("mymysql", dsn)

View File

@ -36,7 +36,7 @@ type myIndexStorage struct {
db *sql.DB
}
var _ index.IndexStorage = (*myIndexStorage)(nil)
var _ index.Storage = (*myIndexStorage)(nil)
// postgres does not have REPLACE INTO (upsert), so we use that custom
// one for Set operations instead
@ -70,9 +70,9 @@ var replacePlaceHolders = func(query string) string {
return string(qmark.ReplaceAllFunc([]byte(query), dollarInc))
}
// NewStorage returns an IndexStorage implementation of the described PostgreSQL database.
// NewStorage returns an index.Storage implementation of the described PostgreSQL database.
// This exists mostly for testing and does not initialize the schema.
func NewStorage(host, user, password, dbname string) (index.IndexStorage, error) {
func NewStorage(host, user, password, dbname string) (index.Storage, error) {
conninfo := fmt.Sprintf("user=%s dbname=%s host=%s password=%s sslmode=require", user, dbname, host, password)
db, err := sql.Open("postgres", conninfo)
if err != nil {

View File

@ -35,7 +35,7 @@ type storage struct {
db *sql.DB
}
var _ index.IndexStorage = (*storage)(nil)
var _ index.Storage = (*storage)(nil)
var compiled = false
@ -54,9 +54,9 @@ func compileHint() string {
return ""
}
// NewStorage returns an IndexStorage implementation of the described SQLite database.
// NewStorage returns an index.Storage implementation of the described SQLite database.
// This exists mostly for testing and does not initialize the schema.
func NewStorage(file string) (index.IndexStorage, error) {
func NewStorage(file string) (index.Storage, error) {
if !compiled {
return nil, ErrNotCompiled
}