Skip to content

Commit

Permalink
FAB-2015 Remove Version from CouchDB QueryResult
Browse files Browse the repository at this point in the history
Motivation for this change:
Version is no longer required in the QueryResult structure.
This also keeps the CouchDB layer to be more generic, since the
CouchDB data layer is used by consumers other than Ledger.

- Remove Version from QueryResult struct in couchdb.go

- Previous changes in FAB1818 remove any reference to Version

- Remove 3 instances where Version is populated with development values

Change-Id: I9ac47e96b9530e23f6a31a075e71ba811e13cf05
Signed-off-by: Chris Elder <chris.elder@us.ibm.com>
  • Loading branch information
Chris Elder committed Feb 8, 2017
1 parent f7c19f8 commit 6a2408b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions core/ledger/util/couchdb/couchdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"strings"
"unicode/utf8"

"github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/version"
logging "github.com/op/go-logging"
)

Expand Down Expand Up @@ -104,9 +103,8 @@ type DocID struct {

//QueryResult is used for returning query results from CouchDB
type QueryResult struct {
ID string
Version *version.Height
Value []byte
ID string
Value []byte
}

//CouchConnectionDef contains parameters
Expand Down Expand Up @@ -713,15 +711,15 @@ func (dbclient *CouchDatabase) ReadDocRange(startKey, endKey string, limit, skip
return nil, err
}

var addDocument = &QueryResult{jsonDoc.ID, version.NewHeight(1, 1), binaryDocument}
var addDocument = &QueryResult{jsonDoc.ID, binaryDocument}

results = append(results, *addDocument)

} else {

logger.Debugf("Adding json docment for id: %s", jsonDoc.ID)

var addDocument = &QueryResult{jsonDoc.ID, version.NewHeight(1, 1), row.Doc}
var addDocument = &QueryResult{jsonDoc.ID, row.Doc}

results = append(results, *addDocument)

Expand Down Expand Up @@ -799,7 +797,7 @@ func (dbclient *CouchDatabase) QueryDocuments(query string, limit, skip int) (*[
logger.Debugf("Adding row to resultset: %s", row)

//TODO Replace the temporary NewHeight version when available
var addDocument = &QueryResult{jsonDoc.ID, version.NewHeight(1, 1), row}
var addDocument = &QueryResult{jsonDoc.ID, row}

results = append(results, *addDocument)

Expand Down

0 comments on commit 6a2408b

Please sign in to comment.