This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package akka.stream.contrib | |
trait CallbackWrapper[T] extends AsyncCallback[T] { | |
private trait CallbackState | |
private case class NotInitialized(list: List[T]) extends CallbackState | |
private case class Initialized(f: T ⇒ Unit) extends CallbackState | |
private case class Stopped(f: T ⇒ Unit) extends CallbackState | |
/* | |
* To preserve message order when switching between not initialized / initialized states |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID | |
import akka.actor.ActorSystem | |
import eventstore.EventStream.Id | |
import eventstore.{Content, EventData, EventStoreExtension, WriteEvents} | |
import scala.concurrent.Await | |
import scala.concurrent.duration.Duration | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func streamMessages(from startOffset: Offset = Offset(value: 0), toExclusive endOffsetOpt : Offset? = .None, | |
includeTransient: Bool = true) -> SignalProducer<Message, NoError> { | |
func streamMessagesChunk(from: Offset) -> SignalProducer<Message, NoError> { | |
func waitForNewMessageAvailable(from: Offset) -> SignalProducer<Offset?, NoError> { | |
return self.lastOffsetIncludingTransient(includeTransient).producer | |
.filter{ offsetOpt in offsetOpt.map {offset in offset >= from } ?? false } | |
.take(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Alamofire | |
import Foundation | |
import enum Result.Result | |
extension Alamofire.Result { | |
func toStandard() -> Result<Value, Error> { | |
switch(self) { | |
case Alamofire.Result.Success(let value) : return Result.Success(value) | |
case Alamofire.Result.Failure(let error) : return Result.Failure(error) | |
} |