swarm/storage/localstore: fix typos and comments

This commit is contained in:
Janos Guljas 2018-12-03 10:24:51 +01:00
parent d8acb127a3
commit 9ec535a28a
3 changed files with 7 additions and 7 deletions

View file

@ -40,12 +40,12 @@ func (db *DB) Accessor(mode Mode) *Accessor {
} }
} }
// Put overwrites the underlying DB Put method for the specific mode of update. // Put uses the underlying DB for the specific mode of update to store the chunk.
func (u *Accessor) Put(ctx context.Context, ch storage.Chunk) error { func (u *Accessor) Put(ctx context.Context, ch storage.Chunk) error {
return u.db.update(ctx, u.mode, chunkToItem(ch)) return u.db.update(ctx, u.mode, chunkToItem(ch))
} }
// Get overwrites the underlying DB Get method for the specific mode of access. // Get uses the underlying DB for the specific mode of access to get the chunk.
func (u *Accessor) Get(_ context.Context, addr storage.Address) (chunk storage.Chunk, err error) { func (u *Accessor) Get(_ context.Context, addr storage.Address) (chunk storage.Chunk, err error) {
item := addressToItem(addr) item := addressToItem(addr)
out, err := u.db.access(u.mode, item) out, err := u.db.access(u.mode, item)

View file

@ -32,7 +32,7 @@ const (
) )
var ( var (
// ErrInvalidMode is retuned when an unkonw Mode // ErrInvalidMode is retuned when an unknown Mode
// is provided to the function. // is provided to the function.
ErrInvalidMode = errors.New("invalid mode") ErrInvalidMode = errors.New("invalid mode")
// ErrDBClosed is returned when database is closed. // ErrDBClosed is returned when database is closed.
@ -183,7 +183,7 @@ func New(path string, baseKey []byte) (db *DB, err error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
// start goroutine what writes batches // start goroutine that writes batches
go db.writeBatches() go db.writeBatches()
return db, nil return db, nil
} }

View file

@ -40,7 +40,7 @@ const (
) )
// ModeName returns a descriptive name of a Mode. // ModeName returns a descriptive name of a Mode.
// If the Mode is not know, a blank string is returned. // If the Mode is not known, a blank string is returned.
func ModeName(m Mode) (name string) { func ModeName(m Mode) (name string) {
switch m { switch m {
case ModeSyncing: case ModeSyncing:
@ -60,7 +60,7 @@ func ModeName(m Mode) (name string) {
} }
// access is called by an Accessor with a specific Mode. // access is called by an Accessor with a specific Mode.
// This function utilizes differnet indexes depending on // This function utilizes different indexes depending on
// the Mode. // the Mode.
func (db *DB) access(mode Mode, item shed.IndexItem) (out shed.IndexItem, err error) { func (db *DB) access(mode Mode, item shed.IndexItem) (out shed.IndexItem, err error) {
out, err = db.retrievalIndex.Get(item) out, err = db.retrievalIndex.Get(item)
@ -79,7 +79,7 @@ func (db *DB) access(mode Mode, item shed.IndexItem) (out shed.IndexItem, err er
} }
// update is called by an Accessor with a specific Mode. // update is called by an Accessor with a specific Mode.
// This function calles updateBatch to perform operations // This function calls updateBatch to perform operations
// on indexes and fields within a single batch. // on indexes and fields within a single batch.
func (db *DB) update(ctx context.Context, mode Mode, item shed.IndexItem) error { func (db *DB) update(ctx context.Context, mode Mode, item shed.IndexItem) error {
db.mu.RLock() db.mu.RLock()