mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/storage: godoc and comments
This commit is contained in:
parent
c9cdc5edcf
commit
7f973b9cae
2 changed files with 4 additions and 0 deletions
|
|
@ -731,6 +731,7 @@ func (s *LDBStore) tryAccessIdx(ikey []byte, index *dpaDBIndex) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// GetSchema is returning the current named schema of the datastore as read from LevelDB
|
||||
func (s *LDBStore) GetSchema() (string, error) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
|
@ -746,6 +747,7 @@ func (s *LDBStore) GetSchema() (string, error) {
|
|||
return string(data), nil
|
||||
}
|
||||
|
||||
// PutSchema is saving a named schema to the LevelDB datastore
|
||||
func (s *LDBStore) PutSchema(schema string) error {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ func (ls *LocalStore) Close() {
|
|||
ls.DbStore.Close()
|
||||
}
|
||||
|
||||
// Migrate checks the datastore schema vs the runtime schema, and runs migrations if they don't match
|
||||
func (ls *LocalStore) Migrate() error {
|
||||
schema, err := ls.DbStore.GetSchema()
|
||||
if err != nil {
|
||||
|
|
@ -200,6 +201,7 @@ func (ls *LocalStore) Migrate() error {
|
|||
log.Debug("running migrations for", "schema", schema, "runtime-schema", CurrentDbSchema)
|
||||
|
||||
cleanupFunc := func(c *chunk) bool {
|
||||
// if one of the ls.Validators passes, it means a chunk is of particular type and it is valid
|
||||
valid := false
|
||||
for _, v := range ls.Validators {
|
||||
if valid = v.Validate(c.Address(), c.Data()); valid {
|
||||
|
|
|
|||
Loading…
Reference in a new issue