Skip to content

Commit

Permalink
Revert "Add common interface between in-memory and on-disk transactio…
Browse files Browse the repository at this point in the history
…n storage"

This reverts commit 3196ade.
  • Loading branch information
Shaptic committed Apr 15, 2024
1 parent 3196ade commit 9a98d4f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 68 deletions.
7 changes: 3 additions & 4 deletions cmd/soroban-rpc/internal/ingest/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Config struct {
Logger *log.Entry
DB db.ReadWriter
EventStore *events.MemoryStore
TransactionStore transactions.TransactionStore
TransactionStore *transactions.MemoryStore
NetworkPassPhrase string
Archive historyarchive.ArchiveInterface
LedgerBackend backends.LedgerBackend
Expand Down Expand Up @@ -134,7 +134,7 @@ type Service struct {
logger *log.Entry
db db.ReadWriter
eventStore *events.MemoryStore
transactionStore transactions.TransactionStore
transactionStore *transactions.MemoryStore
ledgerBackend backends.LedgerBackend
timeout time.Duration
networkPassPhrase string
Expand Down Expand Up @@ -308,8 +308,7 @@ func (s *Service) ingestLedgerCloseMeta(tx db.WriteTx, ledgerCloseMeta xdr.Ledge
return err
}
s.metrics.ingestionDurationMetric.
With(prometheus.Labels{"type": "ledger_close_meta"}).
Observe(time.Since(startTime).Seconds())
With(prometheus.Labels{"type": "ledger_close_meta"}).Observe(time.Since(startTime).Seconds())

if err := s.eventStore.IngestEvents(ledgerCloseMeta); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (h Handler) Close() {

type HandlerParams struct {
EventStore *events.MemoryStore
TransactionStore transactions.TransactionStore
TransactionStore *transactions.MemoryStore
LedgerEntryReader db.LedgerEntryReader
LedgerReader db.LedgerReader
Logger *log.Entry
Expand Down
45 changes: 0 additions & 45 deletions cmd/soroban-rpc/internal/transactions/database.go

This file was deleted.

15 changes: 0 additions & 15 deletions cmd/soroban-rpc/internal/transactions/interface.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type MemoryStore struct {
// will be included in the MemoryStore. If the MemoryStore
// is full, any transactions from new ledgers will evict
// older entries outside the retention window.
func NewMemoryStore(daemon interfaces.Daemon, networkPassphrase string, retentionWindow uint32) TransactionStore {
func NewMemoryStore(daemon interfaces.Daemon, networkPassphrase string, retentionWindow uint32) *MemoryStore {
window := ledgerbucketwindow.NewLedgerBucketWindow[[]xdr.Hash](retentionWindow)

// transactionDurationMetric is a metric for measuring latency of transaction store operations
Expand Down Expand Up @@ -75,7 +75,6 @@ func NewMemoryStore(daemon interfaces.Daemon, networkPassphrase string, retentio
// removed from the store.
func (m *MemoryStore) IngestTransactions(ledgerCloseMeta xdr.LedgerCloseMeta) error {
startTime := time.Now()

reader, err := ingest.NewLedgerTransactionReaderFromLedgerCloseMeta(m.networkPassphrase, ledgerCloseMeta)
if err != nil {
return err
Expand Down Expand Up @@ -136,7 +135,6 @@ func (m *MemoryStore) IngestTransactions(ledgerCloseMeta xdr.LedgerCloseMeta) er
for hash, tx := range hashMap {
m.transactions[hash] = tx
}

m.transactionDurationMetric.With(prometheus.Labels{"operation": "ingest"}).Observe(time.Since(startTime).Seconds())
m.transactionCountMetric.Observe(float64(txCount))
return nil
Expand Down

0 comments on commit 9a98d4f

Please sign in to comment.