Skip to content

Commit

Permalink
Fix typo in code and rename method
Browse files Browse the repository at this point in the history
1.Change 'detaultStateImpl' to 'defaultStateImpl' in state.go.
2.Rename method IsDelete() to IsDeleted() in state_delta.go.

Change-Id: I8afc4aa4542ca9fed1f904db4ae5e79d8d0f4599
Signed-off-by: grapebaba <281165273@qq.com>
  • Loading branch information
GrapeBaBa committed Aug 23, 2016
1 parent 47c3f6c commit db3a694
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/ledger/statemgmt/raw/state_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (impl *StateImpl) AddChangesForPersistence(writeBatch *gorocksdb.WriteBatch
updates := delta.GetUpdates(updatedChaincodeID)
for updatedKey, value := range updates {
compositeKey := statemgmt.ConstructCompositeKey(updatedChaincodeID, updatedKey)
if value.IsDelete() {
if value.IsDeleted() {
writeBatch.DeleteCF(openchainDB.StateCF, compositeKey)
} else {
writeBatch.PutCF(openchainDB.StateCF, compositeKey, value.GetValue())
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/statemgmt/state/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func loadConfig() {
stateImplName, stateImplConfigs, deltaHistorySize)

if len(stateImplName) == 0 {
stateImplName = detaultStateImpl
stateImplName = defaultStateImpl
stateImplConfigs = nil
} else if stateImplName != "buckettree" && stateImplName != "trie" && stateImplName != "raw" {
panic(fmt.Errorf("Error during initialization of state implementation. State data structure '%s' is not valid.", stateImplName))
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/statemgmt/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

var logger = logging.MustGetLogger("state")

const detaultStateImpl = "buckettree"
const defaultStateImpl = "buckettree"

var stateImpl statemgmt.HashableState

Expand Down
8 changes: 4 additions & 4 deletions core/ledger/statemgmt/state_delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (stateDelta *StateDelta) ApplyChanges(anotherStateDelta *StateDelta) {
previousValue = valueHolder.PreviousValue
}

if valueHolder.IsDelete() {
if valueHolder.IsDeleted() {
stateDelta.Delete(chaincodeID, key, previousValue)
} else {
stateDelta.Set(chaincodeID, key, valueHolder.Value, previousValue)
Expand Down Expand Up @@ -158,7 +158,7 @@ func (stateDelta *StateDelta) ComputeCryptoHash() []byte {
for _, key := range sortedKeys {
buffer.WriteString(key)
updatedValue := chaincodeStateDelta.get(key)
if !updatedValue.IsDelete() {
if !updatedValue.IsDeleted() {
buffer.Write(updatedValue.Value)
}
}
Expand Down Expand Up @@ -225,8 +225,8 @@ type UpdatedValue struct {
PreviousValue []byte
}

// IsDelete checks whether the key was deleted
func (updatedValue *UpdatedValue) IsDelete() bool {
// IsDeleted checks whether the key was deleted
func (updatedValue *UpdatedValue) IsDeleted() bool {
return updatedValue.Value == nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/ledger/statemgmt/state_delta_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func retrieveRelevantKeys(updates map[string]*UpdatedValue, startKey string, end
return relevantKeys
}
for k, v := range updates {
if k >= startKey && (endKey == "" || k <= endKey) && !v.IsDelete() {
if k >= startKey && (endKey == "" || k <= endKey) && !v.IsDeleted() {
relevantKeys = append(relevantKeys, k)
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/statemgmt/trie/trie_delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newTrieDelta(stateDelta *statemgmt.StateDelta) *trieDelta {
for _, chaincodeID := range chaincodes {
updates := stateDelta.GetUpdates(chaincodeID)
for key, updatedvalue := range updates {
if updatedvalue.IsDelete() {
if updatedvalue.IsDeleted() {
trieDelta.delete(chaincodeID, key)
} else {
if stateDelta.RollBackwards {
Expand Down

0 comments on commit db3a694

Please sign in to comment.