diff --git a/TODO b/TODO index 959f6f98a..f939d6259 100644 --- a/TODO +++ b/TODO @@ -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: diff --git a/pkg/index/doc.go b/pkg/index/doc.go index a6dbe434c..fc107a420 100644 --- a/pkg/index/doc.go +++ b/pkg/index/doc.go @@ -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: diff --git a/pkg/index/index.go b/pkg/index/index.go index 856274b07..b456f2f10 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -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 } diff --git a/pkg/index/memindex.go b/pkg/index/memindex.go index e0d2ba991..1b07ad622 100644 --- a/pkg/index/memindex.go +++ b/pkg/index/memindex.go @@ -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 diff --git a/pkg/index/mongo/mongoindex.go b/pkg/index/mongo/mongoindex.go index 8f2a1e528..d997b0884 100644 --- a/pkg/index/mongo/mongoindex.go +++ b/pkg/index/mongo/mongoindex.go @@ -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 diff --git a/pkg/index/mysql/mysqlindexer.go b/pkg/index/mysql/mysqlindexer.go index eb3e96650..bb921f723 100644 --- a/pkg/index/mysql/mysqlindexer.go +++ b/pkg/index/mysql/mysqlindexer.go @@ -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) diff --git a/pkg/index/postgres/postgresindexer.go b/pkg/index/postgres/postgresindexer.go index d66a4ba60..3327679e9 100644 --- a/pkg/index/postgres/postgresindexer.go +++ b/pkg/index/postgres/postgresindexer.go @@ -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 { diff --git a/pkg/index/sqlite/sqlite.go b/pkg/index/sqlite/sqlite.go index ecfc54d94..3c54438ad 100644 --- a/pkg/index/sqlite/sqlite.go +++ b/pkg/index/sqlite/sqlite.go @@ -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 }