Comments (6)
For the most part, the methods that don't return an error either have the error in the returned data set or don't really have any recourse. For example, consider the FetchTxByShaList
function. It returns a slice of *TxListReply
which includes a field Err
for each individual transaction. The intent there is you can request multiple transactions at once and some may fetch successfully while others may not.
On the other hand, take the Close
function. Of the 4 implementations we have done, there really is no legitimate response to being unable to close (aside from maybe trying again, but it will almost positively fail too).
I'm not against adding errors to the interface for the others if there is a need since it would be trivial for the existing implementations that don't have an error to return can simply return nil.
from btcdb.
I didn't see error
in TxListReply
, nice touch.
My initial thoughts were with the ExistsSha
and ExistsTxSha
methods. If there is an error with the underlying database read then is it OK to just return false
without repercussions?
I just dug a bit deper and notice some code comments suggest this issue might be a work in progress with the ldb driver: https://github.com/conformal/btcdb/blob/master/ldb/tx.go#L248 and https://github.com/conformal/btcdb/blob/master/ldb/block.go#L230.
from btcdb.
I've asked drahn to comment, but I suspect those should have error added.
from btcdb.
Alright, so I discussed this with drahn and he's in agreement that all of them except FetchTxByShaList
and FetchUnSpentTxByShaList
make sense to have error returns.
@drahn Close(), ExistsSha(), ExistsTxSha(), RollbackClose(), and Sync() all make sense to have an error return.
I will be taking care of adding these shortly.
from btcdb.
@qedus Did these changes address your concerns?
from btcdb.
@davecgh yes this completely addresses my concerns. I am also glad Close
, Sync
and RollbackClose
also have error returns even though I agree that in almost every case no one should care about their values. Thanks!
from btcdb.
Related Issues (7)
- Enable Snappy Compression HOT 1
- README example references deprecated sqlite3 HOT 1
- api change - change []bool to byte array HOT 3
- Support multiple (non-best) chains, concurrent reads on different forks. HOT 7
- BlockShaMissing should include the missing block hash HOT 2
- Remove Db.DropAfterBlockBySha and Db.RollbackClose HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btcdb.