Skip to content

Commit

Permalink
Add scaladoc for EventualPayloadAndType and related classes (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtar authored Feb 1, 2024
1 parent 107f522 commit 64ea44b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ import com.evolutiongaming.kafka.journal.util.Fail
import com.evolutiongaming.kafka.journal.util.Fail.implicits._
import scodec.bits.ByteVector

/** Piece of data prepared for convenient storing into Cassandra row.
*
* Usually the data is stored into the structure similar to the following:
* {{{
* payload_type TEXT,
* payload_txt TEXT,
* payload_bin BLOB
* }}}
* Where usage of either `payload_txt` or `payload_bin` column depends on
* the contents of a `payload` field.
*
* The `payloadType` field is used to determine how the contents of `payload`
* should be treated, i.e. if it should be parsed as JSON.
*/
final case class EventualPayloadAndType(
payload: Either[String, ByteVector],
payloadType: PayloadType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import com.evolutiongaming.kafka.journal.util.Fail.implicits._
import com.evolutiongaming.kafka.journal.{JournalError, JsonCodec, Payload, PayloadType}


/** Decode a payload loaded from an eventual storage.
*
* Converts a structure convenient to store to eventual store, i.e. Cassandra, to a structure, which is convenient to
* use for a business logic.
*/
trait EventualRead[F[_], A] {

def apply(payloadAndType: EventualPayloadAndType): F[A]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import com.evolutiongaming.kafka.journal.{JournalError, JsonCodec, Payload}
import scodec.bits.ByteVector


/** Prepare payload for storing.
*
* Converts a structure convenient for a business logic to a structure, which is convenient to store to eventual store,
* i.e. Cassandra.
*/
trait EventualWrite[F[_], A] {

def apply(payload: A): F[EventualPayloadAndType]
Expand Down

0 comments on commit 64ea44b

Please sign in to comment.