From fac055c24e653866946189f4e21beda82ceec3b5 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 31 May 2013 13:40:38 -0500 Subject: [PATCH] Add comments to clarify interface function caching. This commit attempts to clarify which functions in the Db interface may be returning cached data that the InvalidateCache, InvalidateBlockCache, and InvalidateTxCache functions are used to clear. --- db.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/db.go b/db.go index 5e1526bf..406a4846 100644 --- a/db.go +++ b/db.go @@ -51,7 +51,7 @@ type Db interface { ExistsSha(sha *btcwire.ShaHash) (exists bool) // FetchBlockBySha returns a btcutil Block. The implementation may - // cache the underlying object if desired. + // cache the underlying data if desired. FetchBlockBySha(sha *btcwire.ShaHash) (blk *btcutil.Block, err error) // FetchBlockShaByHeight returns a block hash based on its height in the @@ -65,18 +65,21 @@ type Db interface { FetchHeightRange(startHeight, endHeight int64) (rshalist []btcwire.ShaHash, err error) // FetchTxAllBySha returns several pieces of data for a given - // transaction hash. + // transaction hash. The implementation may cache the underlying data + // if desired. FetchTxAllBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, rtxbuf []byte, rpver uint32, rblksha *btcwire.ShaHash, err error) // FetchTxBufBySha returns the raw bytes and associated protocol version - // for the transaction with the requested hash. + // for the transaction with the requested hash. The implementation may + // cache the underlying data if desired. FetchTxBufBySha(txsha *btcwire.ShaHash) (txbuf []byte, rpver uint32, err error) - // FetchTxBySha returns some data for the given transaction hash. + // FetchTxBySha returns some data for the given transaction hash. The + // implementation may cache the underlying data if desired. FetchTxBySha(txsha *btcwire.ShaHash) (rtx *btcwire.MsgTx, rpver uint32, blksha *btcwire.ShaHash, err error) // FetchTxByShaList returns a TxListReply given an array of transaction - // hashes. + // hashes. The implementation may cache the underlying data if desired. FetchTxByShaList(txShaList []*btcwire.ShaHash) []*TxListReply // FetchTxUsedBySha returns the used/spent buffer for a given @@ -131,6 +134,7 @@ type BlockIterator interface { // NextRow iterates thru all blocks in database. NextRow() bool + // Row returns row data for block iterator. Row() (key *btcwire.ShaHash, pver uint32, buf []byte, err error) }