Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
simerplaha committed Nov 11, 2021
1 parent e8b48d3 commit 50905e8
Show file tree
Hide file tree
Showing 176 changed files with 343 additions and 413 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms

github: [simerplaha]
github: [ simerplaha ]
2 changes: 1 addition & 1 deletion actor/src/main/scala/swaydb/test/TestActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package swaydb.test

import swaydb.ActorConfig.QueueOrder
import swaydb.{Actor, ActorQueue, IO, Scheduler}
import swaydb.{Actor, ActorQueue, Scheduler}

import java.util.concurrent.ConcurrentLinkedQueue
import scala.concurrent.duration.{FiniteDuration, _}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class PathsDistributorPerformanceSpec extends TestBase {
effect.Dir(path5, 5)
),
segments =
//for each Segment's request randomly distribute Segments so that there is always un-even distribution
//of Segments between all 5 folders.
//for each Segment's request randomly distribute Segments so that there is always un-even distribution
//of Segments between all 5 folders.
randomlyDistributeSegments
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import swaydb.core.data.Memory
import swaydb.core.io.file.ForceSaveApplier
import swaydb.core.level.PathsDistributor
import swaydb.core.merge.stats.MergeStats
import swaydb.core.segment.block.binarysearch.{BinarySearchEntryFormat, BinarySearchIndexBlock, BinarySearchIndexBlockConfig}
import swaydb.core.segment.block.bloomfilter.{BloomFilterBlock, BloomFilterBlockConfig}
import swaydb.core.segment.block.hashindex.{HashIndexBlock, HashIndexBlockConfig}
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig}
import swaydb.core.segment.block.sortedindex.{SortedIndexBlock, SortedIndexBlockConfig}
import swaydb.core.segment.block.values.{ValuesBlock, ValuesBlockConfig}
import swaydb.core.segment.block.binarysearch.{BinarySearchEntryFormat, BinarySearchIndexBlockConfig}
import swaydb.core.segment.block.bloomfilter.BloomFilterBlockConfig
import swaydb.core.segment.block.hashindex.HashIndexBlockConfig
import swaydb.core.segment.block.segment.SegmentBlockConfig
import swaydb.core.segment.block.sortedindex.SortedIndexBlockConfig
import swaydb.core.segment.block.values.ValuesBlockConfig
import swaydb.core.segment.entry.reader.PersistentReader
import swaydb.core.segment.io.SegmentReadIO
import swaydb.core.segment.ref.search.ThreadReadState
Expand Down Expand Up @@ -166,7 +166,7 @@ class SegmentReadPerformanceSpec extends TestBase {
cacheBlocksOnCreate = false,
minSize = Int.MaxValue,
maxCount =
// keyValuesCount / 100,
// keyValuesCount / 100,
keyValuesCount,
segmentRefCacheLife = SegmentRefCacheLife.Temporary,
enableHashIndexForListSegment = true,
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/swaydb/core/CoreInitializer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import swaydb.core.level.zero.LevelZero
import swaydb.core.level.{Level, LevelCloser, NextLevel}
import swaydb.core.segment.block
import swaydb.core.segment.block.binarysearch.BinarySearchIndexBlockConfig
import swaydb.core.segment.block.bloomfilter.{BloomFilterBlock, BloomFilterBlockConfig}
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig}
import swaydb.core.segment.block.sortedindex.{SortedIndexBlock, SortedIndexBlockConfig}
import swaydb.core.segment.block.values.{ValuesBlock, ValuesBlockConfig}
import swaydb.core.segment.block.bloomfilter.BloomFilterBlockConfig
import swaydb.core.segment.block.segment.SegmentBlockConfig
import swaydb.core.segment.block.sortedindex.SortedIndexBlockConfig
import swaydb.core.segment.block.values.ValuesBlockConfig
import swaydb.core.segment.ref.search.ThreadReadState
import swaydb.core.sweeper.ByteBufferSweeper.ByteBufferSweeperActor
import swaydb.core.sweeper.{ByteBufferSweeper, FileSweeper, MemorySweeper}
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/swaydb/core/data/KeyValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package swaydb.core.data

import swaydb.IO
import swaydb.core.log.serializer.RangeValueSerializer.OptionRangeValueSerializer
import swaydb.core.log.serializer.{RangeValueSerializer, ValueSerializer}
import swaydb.core.segment.assigner.Assignable
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/swaydb/core/function/FunctionStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

package swaydb.core.function

import java.util.concurrent.ConcurrentHashMap

import swaydb.OK
import swaydb.core.data.{SwayFunction, Value}
import swaydb.data.order.KeyOrder
import swaydb.data.slice.Slice

import java.util.concurrent.ConcurrentHashMap
import scala.annotation.tailrec
import scala.collection.mutable
import scala.jdk.CollectionConverters._
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/swaydb/core/gc/GCStats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package swaydb.core.gc

import com.sun.management.GarbageCollectionNotificationInfo
import swaydb.utils.StorageUnits._

import javax.management.{Notification, NotificationEmitter, NotificationListener}
import scala.concurrent.{Future, Promise}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/swaydb/core/level/LevelRef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package swaydb.core.level

import java.nio.file.Path
import swaydb.core.data.KeyValue
import swaydb.core.level.zero.LevelZero
import swaydb.core.segment.ref.search.ThreadReadState
Expand All @@ -26,6 +25,7 @@ import swaydb.data.config.{ForceSave, MMAP}
import swaydb.data.slice.{Slice, SliceOption}
import swaydb.{Bag, IO}

import java.nio.file.Path
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
import scala.concurrent.duration.FiniteDuration
Expand Down
7 changes: 3 additions & 4 deletions core/src/main/scala/swaydb/core/level/PathsDistributor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@

package swaydb.core.level

import java.nio.file.Path
import java.util
import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.atomic.AtomicBoolean
import com.typesafe.scalalogging.LazyLogging
import swaydb.Error.Segment.ExceptionHandler
import swaydb.IO
import swaydb.core.segment.Segment
import swaydb.effect.{Dir, Reserve}
import swaydb.utils.Options

import java.nio.file.Path
import java.util
import java.util.concurrent.ConcurrentLinkedDeque
import scala.annotation.tailrec
import scala.collection.compat._
import scala.jdk.CollectionConverters._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package swaydb.core.level.compaction.throttle.behaviour

import com.typesafe.scalalogging.LazyLogging
import swaydb.DefActor
import swaydb.core.data.DefIO
import swaydb.core.level._
import swaydb.core.level.compaction.io.CompactionIO
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/swaydb/core/log/PersistentLog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.typesafe.scalalogging.LazyLogging
import swaydb.Error.Log.ExceptionHandler
import swaydb.IO
import swaydb.core.io.file.{DBFile, ForceSaveApplier}
import swaydb.core.log.serializer.{LogEntrySerialiser, LogEntryReader, LogEntryWriter}
import swaydb.core.log.serializer.{LogEntryReader, LogEntrySerialiser, LogEntryWriter}
import swaydb.core.sweeper.ByteBufferSweeper.ByteBufferSweeperActor
import swaydb.core.sweeper.{ByteBufferSweeper, FileSweeper}
import swaydb.data.config.MMAP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import com.typesafe.scalalogging.LazyLogging
import swaydb.core.function.FunctionStore
import swaydb.core.io.file.ForceSaveApplier
import swaydb.core.log
import swaydb.core.log.{Log, RecoveryResult}
import swaydb.core.log.serializer.{AppliedFunctionsLogEntryReader, AppliedFunctionsLogEntryWriter}
import swaydb.core.log.{Log, RecoveryResult}
import swaydb.core.sweeper.ByteBufferSweeper.ByteBufferSweeperActor
import swaydb.core.sweeper.FileSweeper
import swaydb.data.config.MMAP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package swaydb.core.log.serializer

import swaydb.IO
import swaydb.core.data.{Time, Value}
import swaydb.core.io.reader.Reader
import swaydb.core.util.Times._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package swaydb.core.merge

import com.typesafe.scalalogging.LazyLogging
import swaydb.core.data.{Memory, Persistent, Value, _}
import swaydb.core.data._
import swaydb.core.merge.stats.MergeStats

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package swaydb.core.merge.stats

import swaydb.core.data.Memory
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig}
import swaydb.core.segment.block.sortedindex.{SortedIndexBlockConfig, SortedIndexBlock}
import swaydb.core.segment.block.segment.SegmentBlockConfig
import swaydb.core.segment.block.sortedindex.SortedIndexBlockConfig

import scala.collection.mutable.ListBuffer

Expand Down
9 changes: 4 additions & 5 deletions core/src/main/scala/swaydb/core/segment/MemorySegment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
package swaydb.core.segment

import com.typesafe.scalalogging.LazyLogging
import swaydb.core.data.{DefIO, Memory, _}
import swaydb.core.data._
import swaydb.core.function.FunctionStore
import swaydb.core.level.PathsDistributor
import swaydb.core.merge.stats.MergeStats
import swaydb.core.segment.assigner.Assignable
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig}
import swaydb.core.segment.block.sortedindex.SortedIndexBlock
import swaydb.core.segment.block.segment.SegmentBlockConfig
import swaydb.core.segment.defrag.DefragMemorySegment
import swaydb.core.segment.ref.search.ThreadReadState
import swaydb.core.sweeper.FileSweeper
Expand Down Expand Up @@ -82,8 +81,8 @@ private[core] final case class MemorySegment(path: Path,
removeDeletes: Boolean,
createdInLevel: Int,
segmentConfig: SegmentBlockConfig)(implicit idGenerator: IDGenerator,
executionContext: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[MemorySegmentOption, Iterable[MemorySegment]]] =
executionContext: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[MemorySegmentOption, Iterable[MemorySegment]]] =
if (deleted)
Future.failed(swaydb.Exception.NoSuchFile(path))
else {
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/swaydb/core/segment/PersistentSegment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import swaydb.core.merge.stats.MergeStats
import swaydb.core.segment.assigner.Assignable
import swaydb.core.segment.block.binarysearch.BinarySearchIndexBlockConfig
import swaydb.core.segment.block.bloomfilter.BloomFilterBlockConfig
import swaydb.core.segment.block.hashindex.{HashIndexBlock, HashIndexBlockConfig}
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig}
import swaydb.core.segment.block.hashindex.HashIndexBlockConfig
import swaydb.core.segment.block.segment.SegmentBlockConfig
import swaydb.core.segment.block.segment.data.TransientSegment
import swaydb.core.segment.block.sortedindex.{SortedIndexBlock, SortedIndexBlockConfig}
import swaydb.core.segment.block.values.{ValuesBlock, ValuesBlockConfig}
import swaydb.core.segment.block.sortedindex.SortedIndexBlockConfig
import swaydb.core.segment.block.values.ValuesBlockConfig
import swaydb.core.util.IDGenerator
import swaydb.data.compaction.CompactionConfig.CompactionParallelism
import swaydb.data.config.{MMAP, SegmentRefCacheLife}
Expand Down Expand Up @@ -82,8 +82,8 @@ trait PersistentSegment extends Segment with PersistentSegmentOption {
hashIndexConfig: HashIndexBlockConfig,
bloomFilterConfig: BloomFilterBlockConfig,
segmentConfig: SegmentBlockConfig)(implicit idGenerator: IDGenerator,
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegment, Slice[TransientSegment.OneOrRemoteRefOrMany]]]
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegment, Slice[TransientSegment.OneOrRemoteRefOrMany]]]


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import swaydb.core.segment.assigner.Assignable
import swaydb.core.segment.block.BlockCache
import swaydb.core.segment.block.binarysearch.BinarySearchIndexBlockConfig
import swaydb.core.segment.block.bloomfilter.BloomFilterBlockConfig
import swaydb.core.segment.block.hashindex.{HashIndexBlock, HashIndexBlockConfig}
import swaydb.core.segment.block.hashindex.HashIndexBlockConfig
import swaydb.core.segment.block.reader.BlockRefReader
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockConfig, SegmentBlockOffset}
import swaydb.core.segment.block.segment.data.{TransientSegment, TransientSegmentSerialiser}
import swaydb.core.segment.block.sortedindex.{SortedIndexBlock, SortedIndexBlockConfig}
import swaydb.core.segment.block.values.{ValuesBlock, ValuesBlockConfig}
import swaydb.core.segment.block.segment.{SegmentBlockConfig, SegmentBlockOffset}
import swaydb.core.segment.block.sortedindex.SortedIndexBlockConfig
import swaydb.core.segment.block.values.ValuesBlockConfig
import swaydb.core.segment.defrag.DefragPersistentSegment
import swaydb.core.segment.io.SegmentReadIO
import swaydb.core.segment.ref.search.ThreadReadState
Expand Down Expand Up @@ -871,8 +871,8 @@ protected case class PersistentSegmentMany(file: DBFile,
hashIndexConfig: HashIndexBlockConfig,
bloomFilterConfig: BloomFilterBlockConfig,
segmentConfig: SegmentBlockConfig)(implicit idGenerator: IDGenerator,
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegmentMany, Slice[TransientSegment.OneOrRemoteRefOrMany]]] =
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegmentMany, Slice[TransientSegment.OneOrRemoteRefOrMany]]] =
Segment.refreshForNewLevel(
keyValues = iterator(segmentConfig.initialiseIteratorsInOneSeek),
removeDeletes = removeDeletes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import swaydb.core.level.compaction.io.CompactionIO
import swaydb.core.merge.stats.MergeStats
import swaydb.core.segment.assigner.Assignable
import swaydb.core.segment.block.BlockCache
import swaydb.core.segment.block.binarysearch.{BinarySearchIndexBlock, BinarySearchIndexBlockOffset, BinarySearchIndexBlockConfig}
import swaydb.core.segment.block.bloomfilter.{BloomFilterBlock, BloomFilterBlockOffset, BloomFilterBlockConfig}
import swaydb.core.segment.block.hashindex.{HashIndexBlock, HashIndexBlockOffset, HashIndexBlockConfig}
import swaydb.core.segment.block.binarysearch.{BinarySearchIndexBlock, BinarySearchIndexBlockConfig, BinarySearchIndexBlockOffset}
import swaydb.core.segment.block.bloomfilter.{BloomFilterBlock, BloomFilterBlockConfig, BloomFilterBlockOffset}
import swaydb.core.segment.block.hashindex.{HashIndexBlock, HashIndexBlockConfig, HashIndexBlockOffset}
import swaydb.core.segment.block.reader.{BlockRefReader, UnblockedReader}
import swaydb.core.segment.block.segment.data.TransientSegment
import swaydb.core.segment.block.segment.footer.SegmentFooterBlock
import swaydb.core.segment.block.segment.{SegmentBlock, SegmentBlockCache, SegmentBlockConfig}
import swaydb.core.segment.block.segment.{SegmentBlockCache, SegmentBlockConfig}
import swaydb.core.segment.block.sortedindex.{SortedIndexBlock, SortedIndexBlockConfig, SortedIndexBlockOffset}
import swaydb.core.segment.block.values.{ValuesBlock, ValuesBlockConfig, ValuesBlockOffset}
import swaydb.core.segment.defrag.DefragPersistentSegment
Expand Down Expand Up @@ -352,8 +352,8 @@ protected case class PersistentSegmentOne(file: DBFile,
hashIndexConfig: HashIndexBlockConfig,
bloomFilterConfig: BloomFilterBlockConfig,
segmentConfig: SegmentBlockConfig)(implicit idGenerator: IDGenerator,
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegment, Slice[TransientSegment.OneOrRemoteRefOrMany]]] = {
ec: ExecutionContext,
compactionParallelism: CompactionParallelism): Future[DefIO[PersistentSegment, Slice[TransientSegment.OneOrRemoteRefOrMany]]] = {
// val footer = ref.getFooter()
//if it's created in the same level the required spaces for sortedIndex and values
//will be the same as existing or less than the current sizes so there is no need to create a
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/swaydb/core/segment/Segment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package swaydb.core.segment

import com.typesafe.scalalogging.LazyLogging
import swaydb.Aggregator
import swaydb.Error.Segment.ExceptionHandler
import swaydb.core.data._
import swaydb.core.function.FunctionStore
Expand Down Expand Up @@ -49,7 +50,6 @@ import swaydb.data.slice.{Slice, SliceOption}
import swaydb.effect.Effect
import swaydb.utils.Futures.FutureUnitImplicits
import swaydb.utils.{FiniteDurations, SomeOrNone}
import swaydb.{Aggregator, IO}

import java.nio.file.Path
import scala.annotation.tailrec
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala/swaydb/core/segment/assigner/Assigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private[core] object Assigner {
def assignUnsafeGaps[GAP](keyValues: IterableOnce[Assignable],
segments: IterableOnce[Segment],
initialiseIteratorsInOneSeek: Boolean)(implicit keyOrder: KeyOrder[Slice[Byte]],
gapCreator: Aggregator.Creator[Assignable, GAP]): ListBuffer[Assignment[GAP, ListBuffer[Assignable], Segment]] =
gapCreator: Aggregator.Creator[Assignable, GAP]): ListBuffer[Assignment[GAP, ListBuffer[Assignable], Segment]] =
assignUnsafe[GAP, ListBuffer[Assignable], Segment](
keyValues = keyValues.iterator,
segmentsIterator = segments.iterator,
Expand All @@ -73,7 +73,7 @@ private[core] object Assigner {
def assignUnsafeGapsSegmentRef[GAP](keyValues: IterableOnce[Assignable],
segments: IterableOnce[SegmentRef],
initialiseIteratorsInOneSeek: Boolean)(implicit keyOrder: KeyOrder[Slice[Byte]],
gapCreator: Aggregator.Creator[Assignable, GAP]): ListBuffer[Assignment[GAP, ListBuffer[Assignable], SegmentRef]] =
gapCreator: Aggregator.Creator[Assignable, GAP]): ListBuffer[Assignment[GAP, ListBuffer[Assignable], SegmentRef]] =
assignUnsafe[GAP, ListBuffer[Assignable], SegmentRef](
keyValues = keyValues.iterator,
segmentsIterator = segments.iterator,
Expand All @@ -84,9 +84,9 @@ private[core] object Assigner {
def assignUnsafeGaps[GAP, MID <: Iterable[_], SEG >: Null](keyValues: IterableOnce[Assignable],
segments: IterableOnce[SEG],
initialiseIteratorsInOneSeek: Boolean)(implicit keyOrder: KeyOrder[Slice[Byte]],
midCreator: Aggregator.Creator[Assignable, MID],
gapCreator: Aggregator.Creator[Assignable, GAP],
assignmentTarget: AssignmentTarget[SEG]): ListBuffer[Assignment[GAP, MID, SEG]] =
midCreator: Aggregator.Creator[Assignable, MID],
gapCreator: Aggregator.Creator[Assignable, GAP],
assignmentTarget: AssignmentTarget[SEG]): ListBuffer[Assignment[GAP, MID, SEG]] =
assignUnsafe[GAP, MID, SEG](
keyValues = keyValues.iterator,
segmentsIterator = segments.iterator,
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/swaydb/core/segment/block/Block.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package swaydb.core.segment.block

import com.typesafe.scalalogging.LazyLogging
import swaydb.IO
import swaydb.compression.{CompressionInternal, DecompressorInternal}
import swaydb.core.io.reader.Reader
import swaydb.core.segment.block.reader.{BlockRefReader, BlockedReader, UnblockedReader}
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/scala/swaydb/core/segment/block/BlockOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
package swaydb.core.segment.block

private[core] trait BlockOps[O <: BlockOffset, B <: Block[O]] {

def updateBlockOffset(block: B, start: Int, size: Int): B

def createOffset(start: Int, size: Int): O

def readBlock(header: BlockHeader[O]): B

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package swaydb.core.segment.block.reader

import com.typesafe.scalalogging.LazyLogging
import swaydb.IO
import swaydb.core.segment.block.{BlockCache, BlockCacheSource, BlockOffset}
import swaydb.data.slice.{Reader, ReaderBase, Slice, SliceOption}

Expand Down
Loading

0 comments on commit 50905e8

Please sign in to comment.