Class

curiodb

StringNode

Related Doc: package curiodb

Permalink

class StringNode extends Node[String]

String commands. Note that unlike Redis, bitmap and HLL commands have their own data types and corresponding classes, namely BitmapNode and HyperLogLogNode.

Linear Supertypes
Node[String], ActorLogging, CommandProcessing, PersistentActor, Eventsourced, PersistenceRecovery, PersistenceIdentity, StashFactory, Stash, RequiresMessageQueue[DequeBasedMessageQueueSemantics], UnrestrictedStash, StashSupport, Snapshotter, Actor, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. StringNode
  2. Node
  3. ActorLogging
  4. CommandProcessing
  5. PersistentActor
  6. Eventsourced
  7. PersistenceRecovery
  8. PersistenceIdentity
  9. StashFactory
  10. Stash
  11. RequiresMessageQueue
  12. UnrestrictedStash
  13. StashSupport
  14. Snapshotter
  15. Actor
  16. AnyRef
  17. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new StringNode()

    Permalink

Type Members

  1. type CommandRunner = PartialFunction[String, Any]

    Permalink

    Signature for the partial function CommandRunner that actually handles each command.

    Signature for the partial function CommandRunner that actually handles each command. Every Node must implement the "run" method of this type (this requirement is actually codified in the base Node class). It takes a case statement mapping command names to the code that handles them - typically handled inline, or via a method if more complex. The result will then be sent back to the calling ClientNode, and converted into a Redis response before being sent back to the client socket. One special case is the handler returning Unit, in which case no response is sent back, in which case it's up to the handling code to manually send a response back to the client node. A common example of this is all of the aggregation commands, which need to coordinate with multiple nodes before calculating a response. But the bulk of commands are simple one-liners directly returning a response.

    Definition Classes
    CommandProcessing
  2. type Receive = PartialFunction[Any, Unit]

    Permalink
    Definition Classes
    Actor

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def aggregate(props: Props): Unit

    Permalink

    Shortcut for creating Aggregate actors.

    Shortcut for creating Aggregate actors.

    Definition Classes
    CommandProcessing
  5. def args: Seq[String]

    Permalink

    Shortcut to the args of the current command.

    Shortcut to the args of the current command.

    Definition Classes
    CommandProcessing
  6. def aroundPostRestart(reason: Throwable): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  7. def aroundPostStop(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  8. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  9. def aroundPreStart(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  10. def aroundReceive(receive: Receive, message: Any): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def beginTransaction(): Any

    Permalink

    Moves the current value into a transaction for the current command's client ID.

    Moves the current value into a transaction for the current command's client ID. This can occur at the start of a transaction (eg _MULTI command), or if the Node actor is created inside a transaction, in which case we use emptyValue, which handles the edge case of a Node existing, going into a transaction, being marked deleted, then being recreated.

    Definition Classes
    Node
  13. def bounds(from: Int, to: Int, size: Int): (Int, Int)

    Permalink

    Utility for handling boundary args that wrap around ends of sequences and count backwards when negative.

    Utility for handling boundary args that wrap around ends of sequences and count backwards when negative.

    Definition Classes
    CommandProcessing
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def cloneValue: String

    Permalink

    Clones the value for use in a new transaction.

    Clones the value for use in a new transaction. Node subclasses that work on mutable values must override, typically by calling value.clone, otherwise we just default to the current value.

    Definition Classes
    Node
  16. def closeTransaction(clientId: String = command.clientId, committing: Boolean = false): Option[String]

    Permalink

    Removes and returns the transaction value.

    Removes and returns the transaction value. Expected to run twice per transaction - once when commitTransaction is called when _EXEC is received, and once when the transaction times out. We also check for the lack of a committed value, which indicates that the actor was created in a transaction

    Definition Classes
    Node
  17. var command: Command

    Permalink

    The current command - normally will be set when a Command arrives via the actor's receive method.

    The current command - normally will be set when a Command arrives via the actor's receive method.

    Definition Classes
    CommandProcessing
  18. val commandTimeout: Int

    Permalink

    Timeout for a single command.

    Timeout for a single command. Used by ClientNode to schedule timeout handlers for commands, and also in ScriptRunner to determine what the timeout for a Lua script should be.

    Definition Classes
    CommandProcessing
  19. def commitTransaction(): Any

    Permalink

    Removes the transaction value and writes it back into the main value.

    Removes the transaction value and writes it back into the main value. This could be called after the transaction has timed out, so we only move the value if we're still in a transaction.

    Definition Classes
    Node
  20. implicit val context: ActorContext

    Permalink
    Definition Classes
    Actor
  21. val debug: Boolean

    Permalink

    Flag that enables detailed command debugging.

    Flag that enables detailed command debugging.

    Definition Classes
    CommandProcessing
  22. def deferAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  23. def deleteMessages(toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Eventsourced
  24. def deleteOldSnapshots(stopping: Boolean = false): Unit

    Permalink

    Deletes old snapshots after a new one is saved.

    Deletes old snapshots after a new one is saved.

    Definition Classes
    Node
  25. def deleteSnapshot(sequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  26. def deleteSnapshots(criteria: SnapshotSelectionCriteria): Unit

    Permalink
    Definition Classes
    Snapshotter
  27. def durationSetting(name: String): Int

    Permalink

    Retrieves a duration config setting as milliseconds, and handles the value not being a duration value, so we can do something like set it to "off", in which case we default to 0.

    Retrieves a duration config setting as milliseconds, and handles the value not being a duration value, so we can do something like set it to "off", in which case we default to 0.

    Definition Classes
    CommandProcessing
  28. def emptyValue: String

    Permalink

    Returns the default value for the type of Node, which subclasses must override.

    Returns the default value for the type of Node, which subclasses must override. Used to set the initial value when a Node is first created, and also in the edge case of resetting a transaction's value if within a transaction, the Node is marked deleted, and then recreated.

    Definition Classes
    StringNodeNode
  29. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  30. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  31. def expire(commandName: String): Unit

    Permalink

    Handles calling the EXPIRE/PEXPIRE commands for the SETEX/PSETEX commands.

  32. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  34. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  35. def inTransaction: Boolean

    Permalink

    Checks if the current Command is in a transaction.

    Checks if the current Command is in a transaction.

    Definition Classes
    Node
  36. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  37. val isolationLevel: String

    Permalink

    Transaction isolation level: "repeatable" reads, read "committed", or read "uncommitted".

    Transaction isolation level: "repeatable" reads, read "committed", or read "uncommitted".

    Definition Classes
    Node
  38. def journalPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  39. def lastSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced
  40. var lastSnapshot: Option[SnapshotMetadata]

    Permalink

    The most recently saved snapshot.

    The most recently saved snapshot. We store it on save and recover, so that we can delete it (and any earlier snapshots) each time we successfully save a new snapshot.

    Definition Classes
    Node
  41. def loadSnapshot(persistenceId: String, criteria: SnapshotSelectionCriteria, toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  42. def log: LoggingAdapter

    Permalink
    Definition Classes
    ActorLogging
  43. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  44. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  45. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  46. def numberToString(n: Any): String

    Permalink

    Utility for dropping extraneous zeros from floats when converting to strings, for consistency with Redis' INCRBYFLOAT/HINCRBYFLOAT commands and sorted set scores.

    Utility for dropping extraneous zeros from floats when converting to strings, for consistency with Redis' INCRBYFLOAT/HINCRBYFLOAT commands and sorted set scores.

    Definition Classes
    CommandProcessing
  47. def onPersistFailure(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  48. def onPersistRejected(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  49. def onRecoveryFailure(cause: Throwable, event: Option[Any]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  50. def pattern(values: Iterable[String], pattern: String): Iterable[String]

    Permalink

    Utility for glob-style filtering.

    Utility for glob-style filtering.

    Definition Classes
    CommandProcessing
  51. def persist[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  52. val persistAfter: Int

    Permalink

    Stores the duration which controls the minimum delay between receiving a command that writes, and persisting the actual value written.

    Stores the duration which controls the minimum delay between receiving a command that writes, and persisting the actual value written.

    Definition Classes
    Node
  53. def persistAll[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  54. def persistAllAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  55. def persistAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  56. def persistenceId: String

    Permalink
    Definition Classes
    Node → PersistenceIdentity
  57. var persisting: Boolean

    Permalink

    Boolean representing whether we've scheduled an internal Persist message, so that it only occurs once at a time according to the duration configured by the curiodb.persist-after setting.

    Boolean representing whether we've scheduled an internal Persist message, so that it only occurs once at a time according to the duration configured by the curiodb.persist-after setting.

    Definition Classes
    Node
  58. def postRestart(reason: Throwable): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  59. def postStop(): Unit

    Permalink
    Definition Classes
    UnrestrictedStash → Actor
  60. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Definition Classes
    UnrestrictedStash → Actor
  61. def preStart(): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  62. def randomItem(iterable: Iterable[String]): String

    Permalink

    Utility for selecting a random item.

    Utility for selecting a random item.

    Definition Classes
    CommandProcessing
  63. def receive: Receive

    Permalink
    Definition Classes
    Node → PersistentActor → Actor
  64. def receiveCommand: Receive

    Permalink

    Main Receive handler - deals with starting/stopping/persisting, and receiving Command instances, then running the Node actor's CommandRunner.

    Main Receive handler - deals with starting/stopping/persisting, and receiving Command instances, then running the Node actor's CommandRunner.

    Definition Classes
    Node → Eventsourced
  65. def receiveRecover: Receive

    Permalink

    Restore the Node actor's value on startup.

    Restore the Node actor's value on startup.

    Definition Classes
    Node → Eventsourced
  66. def recovery: Recovery

    Permalink
    Definition Classes
    PersistenceRecovery
  67. def recoveryFinished: Boolean

    Permalink
    Definition Classes
    Eventsourced
  68. def recoveryRunning: Boolean

    Permalink
    Definition Classes
    Eventsourced
  69. def rename(fromValue: Any, toCommand: String): Unit

    Permalink

    Handles the RENAME/RENAMENX commands for all node types.

    Handles the RENAME/RENAMENX commands for all node types. Each Node subclass is responsible for converting its value to something that can be used by the relevant command given - this command is typically implemented (and named) differently per node, and knows how to accept fromValue. Renaming is basically a delete, then create a new node, so we first delete ourselves (via the internal _DEL command), then pass the fromValue arg with the given command to what will be a newly created Node.

    Definition Classes
    Node
  70. def respond(response: Any): Unit

    Permalink

    Sends a Response (usually the result of a command) back to the command's destination (usually a ClientNode sending a Command).

    Sends a Response (usually the result of a command) back to the command's destination (usually a ClientNode sending a Command).

    Definition Classes
    CommandProcessing
  71. def route(input: Seq[Any], client: Option[ActorRef] = None): Unit

    Permalink

    Shortcut route method for sending command input without a constructed Command instance, using the state of the current command (eg: db, clientID).

    Shortcut route method for sending command input without a constructed Command instance, using the state of the current command (eg: db, clientID).

    Definition Classes
    CommandProcessing
  72. def route(command: Command): Unit

    Permalink

    Sends an unrouted Command to one or more KeyNode actors, either by routing by key, or broadcasting to all.

    Sends an unrouted Command to one or more KeyNode actors, either by routing by key, or broadcasting to all.

    Definition Classes
    CommandProcessing
  73. def run: CommandRunner

    Permalink

    Abstract definition of each Node actor's CommandRunner that must be implemented.

    Abstract definition of each Node actor's CommandRunner that must be implemented. It's the partial function that matches a Command name to the code that runs it.

    Definition Classes
    StringNodeNode
  74. def runForAnyNode: CommandRunner

    Permalink

    Alternate Receive handler for all Node actors - these are internal commands can run for any Node type, and are not validated in any way, nor are they configured in commands.conf.

    Alternate Receive handler for all Node actors - these are internal commands can run for any Node type, and are not validated in any way, nor are they configured in commands.conf. Currently used for transaction begin (_MULTI) and commit (_EXEC).

    When _MULTI is received and a transaction is beginning, we store the current value in the transaction map against the transaction's client ID. Subsequent commands within the transaction will then read from and write to the transaction map, until it's committed via the _EXEC command, at which point we copy the value from the transaction map back to the main value, and remove it from the transaction map.

    The transaction may also timeout which is scheduled when _MULTI is received. If this occurs and then _EXEC is received, we don't send acknowledgement back to the ClientNode, so it can then deal with its own timeout.

    Definition Classes
    Node
  75. def save(): Unit

    Permalink

    As discussed above, saves a snapshot.

    As discussed above, saves a snapshot. If curiodb.persist-after is zero or less (which means every change must cause a snapshot to be saved), then just save a snapshot. Otherwise schedule the internal Persist message to save a snapshot, if none has already been scheduled, according to the value of the persisting var.

    Definition Classes
    Node
  76. def saveSnapshot(snapshot: Any): Unit

    Permalink
    Definition Classes
    Snapshotter
  77. def scan(values: Iterable[String]): Seq[String]

    Permalink

    Utility for scan-style commands, namely SCAN/SSCAN/HSCAN/ZSCAN.

    Utility for scan-style commands, namely SCAN/SSCAN/HSCAN/ZSCAN.

    Definition Classes
    CommandProcessing
  78. implicit final val self: ActorRef

    Permalink
    Definition Classes
    Actor
  79. final def sender(): ActorRef

    Permalink
    Definition Classes
    Actor
  80. def slice[T](value: Seq[T]): Seq[T]

    Permalink

    Utility for slicing sequences, for commands such as SLICE, GETRANGE, LRANGE, etc.

    Utility for slicing sequences, for commands such as SLICE, GETRANGE, LRANGE, etc.

    Definition Classes
    CommandProcessing
  81. def snapshotPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  82. def snapshotSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  83. def snapshotterId: String

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  84. def sort(values: Iterable[String]): Any

    Permalink

    Handles the SORT command.

    Handles the SORT command. Defined here since it can be run against multiple Node types, namely ListNode, SetNode and SortedSetNode.

    Definition Classes
    Node
  85. def stash(): Unit

    Permalink
    Definition Classes
    StashSupport
  86. def stop(): Unit

    Permalink

    Stops the actor - we define this shortcut to give subclassing traits the chance to override it and inject extra shutdown behavior that concrete actors need not know about.

    Stops the actor - we define this shortcut to give subclassing traits the chance to override it and inject extra shutdown behavior that concrete actors need not know about. Note we wrap context.stop with Try here since it may be called twice due to transaction timeouts.

    Definition Classes
    CommandProcessing
  87. def supervisorStrategy: SupervisorStrategy

    Permalink
    Definition Classes
    Actor
  88. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  89. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  90. val transactionTimeout: Int

    Permalink

    Stores the duration which controls the amount of time we allow a transaction to exist for.

    Stores the duration which controls the amount of time we allow a transaction to exist for. This ensures that if for some reason the transaction does not complete, it can start handling write commands again.

    Definition Classes
    Node
  91. def unhandled(message: Any): Unit

    Permalink
    Definition Classes
    Eventsourced → Actor
  92. def unstashAll(): Unit

    Permalink
    Definition Classes
    Eventsourced → StashSupport
  93. def value: String

    Permalink

    Value getter according to the configured transaction isolation level:

    Value getter according to the configured transaction isolation level:

    - repeatable: should always return the value of the current transaction - uncommitted: always returns the newest written value, even if uncommitted - committed: always return the commit value, even inside a transaction

    Note that there is no "serializable" level since there is no notion of a range query. You can read more info on isolation levels here: https://en.wikipedia.org/wiki/Isolation_(database_systems)

    Definition Classes
    Node
  94. def valueOrZero: String

    Permalink

    Returns a default "0" string if the current value is an empty string, which mimics the behaviour of Redis for integer/float commands (INCR, DECR, etc) on string values.

  95. def value_=(value: String): Unit

    Permalink

    Value setter - writes the current value, either to the main key, or a client ID if in a transaction.

    Value setter - writes the current value, either to the main key, or a client ID if in a transaction.

    Definition Classes
    Node
  96. var values: LinkedHashMap[String, String]

    Permalink

    MVCC map of transaction values for the Node mapped to client IDs, including the committed "main" value, which is identified with an empty string as its key.

    MVCC map of transaction values for the Node mapped to client IDs, including the committed "main" value, which is identified with an empty string as its key. LinkedHashMap is used so that we can access the most recently written value when transaction isolation is configued as read-uncommitted.

    Definition Classes
    Node
  97. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  98. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  99. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def persist[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAll instead

  2. def persistAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAllAsync instead

Inherited from Node[String]

Inherited from ActorLogging

Inherited from CommandProcessing

Inherited from PersistentActor

Inherited from Eventsourced

Inherited from PersistenceRecovery

Inherited from PersistenceIdentity

Inherited from StashFactory

Inherited from Stash

Inherited from RequiresMessageQueue[DequeBasedMessageQueueSemantics]

Inherited from UnrestrictedStash

Inherited from StashSupport

Inherited from Snapshotter

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped