From fa45ee286b9ea878645e2ed567d0c8499502c0dc Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 21 Jul 2022 11:22:36 -0700 Subject: [PATCH] #4433: pr feedback, cleanup up method docs --- exp/lighthorizon/archive/main.go | 38 +++++++++++-------------------- exp/lighthorizon/services/main.go | 5 +--- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/exp/lighthorizon/archive/main.go b/exp/lighthorizon/archive/main.go index 00b3a57620..1f46a68105 100644 --- a/exp/lighthorizon/archive/main.go +++ b/exp/lighthorizon/archive/main.go @@ -31,38 +31,26 @@ type LedgerTransactionReader interface { // Archive here only has the methods LightHorizon cares about, to make caching/wrapping easier type Archive interface { - //GetLedger - retreive a ledger's meta data - // - //ctx - the caller's request context - //ledgerCloseMeta - the sequence number of ledger to fetch - // - //returns error or meta data for requested ledger + // GetLedger - takes a caller context and a sequence number and returns the meta data + // for the ledger corresponding to the sequence number. If there is any error, it will + // return nil and the error. GetLedger(ctx context.Context, sequence uint32) (xdr.LedgerCloseMeta, error) - // Close - releases any resources used for this archive instance. + // Close - will release any resources used for this archive instance and should be + // called at end of usage of archive. Close() error - // NewLedgerTransactionReaderFromLedgerCloseMeta - get a reader for ledger meta data - // - // networkPassphrase - the network passphrase - // ledgerCloseMeta - the meta data for a ledger - // - // returns error or LedgerTransactionReader + // NewLedgerTransactionReaderFromLedgerCloseMeta - takes the passphrase for the blockchain network + // and the LedgerCloseMeta(meta data) and returns a reader that can be used to obtain a LedgerTransaction model + // from the meta data. If there is any error, it will return nil and the error. NewLedgerTransactionReaderFromLedgerCloseMeta(networkPassphrase string, ledgerCloseMeta xdr.LedgerCloseMeta) (LedgerTransactionReader, error) - // GetTransactionParticipants - get set of all participants(accounts) in a transaction - // - // transaction - the ledger transaction - // - // returns error or map with keys of participant account id's and value of empty struct + // GetTransactionParticipants - takes a LedgerTransaction and returns a set of all + // participants(accounts) in the transaction. If there is any error, it will return nil and the error. GetTransactionParticipants(transaction LedgerTransaction) (map[string]struct{}, error) - // GetOperationParticipants - get set of all participants(accounts) in a operation - // - // transaction - the ledger transaction - // operation - the operation within this transaction - // opIndex - the 0 based index of the operation within the transaction - // - // returns error or map with keys of participant account id's and value of empty struct + // GetOperationParticipants - takes a LedgerTransaction, the Operation within the transaction, and + // the 0 based index of the operation within the transaction. It will return a set of all participants(accounts) + // in the operation. If there is any error, it will return nil and the error. GetOperationParticipants(transaction LedgerTransaction, operation xdr.Operation, opIndex int) (map[string]struct{}, error) } diff --git a/exp/lighthorizon/services/main.go b/exp/lighthorizon/services/main.go index 3b45832606..e0f2c00e51 100644 --- a/exp/lighthorizon/services/main.go +++ b/exp/lighthorizon/services/main.go @@ -90,10 +90,7 @@ func (ts *TransactionsService) GetTransactionsByAccount(ctx context.Context, cur LedgerHeader: ledgerHeader, TxIndex: int32(tx.Index), }) - if uint64(len(txs)) == limit { - return true, nil - } - return false, nil + return (uint64(len(txs)) >= limit), nil } if err := searchTxByAccount(ctx, cursor, accountId, ts.Config, txsCallback); err != nil {