inklabs/rangedb

View on GitHub
provider/leveldbstore/leveldb_store.go

Summary

Maintainability
B
5 hrs
Test Coverage
A
95%

Showing 7 of 7 total issues

Method levelDbStore.saveEvents has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *levelDbStore) saveEvents(ctx context.Context, expectedStreamSequenceNumber *uint64, streamName string, eventRecords ...*rangedb.EventRecord) (uint64, error) {
if len(eventRecords) < 1 {
return 0, fmt.Errorf("missing events")
}
 
 
Severity: Minor
Found in provider/leveldbstore/leveldb_store.go - About 1 hr to fix

    Method levelDbStore.OptimisticDeleteStream has 8 return statements (exceeds 4 allowed).
    Open

    func (s *levelDbStore) OptimisticDeleteStream(ctx context.Context, expectedStreamSequenceNumber uint64, streamName string) error {
    select {
    case <-ctx.Done():
    return context.Canceled
     
     
    Severity: Major
    Found in provider/leveldbstore/leveldb_store.go - About 50 mins to fix

      Method levelDbStore.saveEvents has 7 return statements (exceeds 4 allowed).
      Open

      func (s *levelDbStore) saveEvents(ctx context.Context, expectedStreamSequenceNumber *uint64, streamName string, eventRecords ...*rangedb.EventRecord) (uint64, error) {
      if len(eventRecords) < 1 {
      return 0, fmt.Errorf("missing events")
      }
       
       
      Severity: Major
      Found in provider/leveldbstore/leveldb_store.go - About 45 mins to fix

        Method levelDbStore.saveEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (s *levelDbStore) saveEvent(ctx context.Context, transaction *leveldb.Transaction, streamName, aggregateType, aggregateID, eventType, eventID string, expectedStreamSequenceNumber *uint64, event, metadata interface{}) ([]byte, uint64, error) {
        Severity: Minor
        Found in provider/leveldbstore/leveldb_store.go - About 35 mins to fix

          Method levelDbStore.saveEvent has 5 return statements (exceeds 4 allowed).
          Open

          func (s *levelDbStore) saveEvent(ctx context.Context, transaction *leveldb.Transaction, streamName, aggregateType, aggregateID, eventType, eventID string, expectedStreamSequenceNumber *uint64, event, metadata interface{}) ([]byte, uint64, error) {
           
          select {
          case <-ctx.Done():
          return nil, 0, context.Canceled
          Severity: Major
          Found in provider/leveldbstore/leveldb_store.go - About 35 mins to fix

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

            func (s *levelDbStore) AggregateTypesSubscription(ctx context.Context, bufferSize int, subscriber rangedb.RecordSubscriber, aggregateTypes ...string) rangedb.RecordSubscription {
            return recordsubscriber.New(
            recordsubscriber.AggregateTypesConfig(ctx, s, s.broadcaster, bufferSize,
            aggregateTypes,
            func(record *rangedb.Record) error {
            Severity: Major
            Found in provider/leveldbstore/leveldb_store.go and 4 other locations - About 1 hr to fix
            provider/eventstore/eventstore.go on lines 584..593
            provider/inmemorystore/inmemory_store.go on lines 373..382
            provider/postgresstore/postgres_store.go on lines 350..359
            provider/remotestore/remote_store.go on lines 277..286

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

            func (s *levelDbStore) AllEventsSubscription(ctx context.Context, bufferSize int, subscriber rangedb.RecordSubscriber) rangedb.RecordSubscription {
            return recordsubscriber.New(
            recordsubscriber.AllEventsConfig(ctx, s, s.broadcaster, bufferSize,
            func(record *rangedb.Record) error {
            subscriber.Accept(record)
            Severity: Major
            Found in provider/leveldbstore/leveldb_store.go and 4 other locations - About 50 mins to fix
            provider/eventstore/eventstore.go on lines 574..582
            provider/inmemorystore/inmemory_store.go on lines 363..371
            provider/postgresstore/postgres_store.go on lines 340..348
            provider/remotestore/remote_store.go on lines 267..275
            Category
            Status