本文整理汇总了Java中com.github.msemys.esjc.WriteResult类的典型用法代码示例。如果您正苦于以下问题:Java WriteResult类的具体用法?Java WriteResult怎么用?Java WriteResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WriteResult类属于com.github.msemys.esjc包,在下文中一共展示了WriteResult类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: append
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
@Override
public int append(
final String streamId,
final List<EventData<T>> events,
final ExpectedVersion version) {
Preconditions.checkNotNull(events);
ElderPreconditions.checkNotEmpty(events);
List<com.github.msemys.esjc.EventData> esEvents = events
.stream()
.map(this::toEsEventData)
.collect(Collectors.toList());
logger.debug("Writing {} events to stream {} (in {}) (expected version {})",
esEvents.size(), streamId, streamPrefix, version);
try {
WriteResult result = completeWriteFuture(
eventStore.appendToStream(
toEsStreamId(streamId),
toEsVersion(version),
esEvents),
version);
int nextExpectedVersion = result.nextExpectedVersion;
logger.debug("Write successful, next expected version is {}", nextExpectedVersion);
return nextExpectedVersion;
} catch (WrongExpectedVersionException ex) {
logger.warn("Unexpected version when attempting append", ex);
throw new UnexpectedVersionException(
ex.getMessage(),
null,
version);
}
}
示例2: CommitTransactionOperation
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
public CommitTransactionOperation(CompletableFuture<WriteResult> result,
boolean requireMaster,
long transactionId,
UserCredentials userCredentials) {
super(result, TcpCommand.TransactionCommit, TcpCommand.TransactionCommitCompleted, userCredentials);
this.requireMaster = requireMaster;
this.transactionId = transactionId;
}
示例3: AppendToStreamOperation
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
public AppendToStreamOperation(CompletableFuture<WriteResult> result,
boolean requireMaster,
String stream,
long expectedVersion,
Iterable<EventData> events,
UserCredentials userCredentials) {
super(result, TcpCommand.WriteEvents, TcpCommand.WriteEventsCompleted, userCredentials);
this.requireMaster = requireMaster;
this.stream = stream;
this.expectedVersion = expectedVersion;
this.events = events;
}
示例4: transformResponseMessage
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
@Override
protected WriteResult transformResponseMessage(TransactionCommitCompleted response) {
long preparePosition = response.hasPreparePosition() ? response.getPreparePosition() : -1;
long commitPosition = response.hasCommitPosition() ? response.getCommitPosition() : -1;
return new WriteResult(response.getLastEventNumber(), new Position(preparePosition, commitPosition));
}
示例5: transformResponseMessage
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
@Override
protected WriteResult transformResponseMessage(WriteEventsCompleted response) {
long preparePosition = response.hasPreparePosition() ? response.getPreparePosition() : -1;
long commitPosition = response.hasCommitPosition() ? response.getCommitPosition() : -1;
return new WriteResult(response.getLastEventNumber(), new Position(preparePosition, commitPosition));
}
示例6: commit
import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
CompletableFuture<WriteResult> commit(Transaction transaction, UserCredentials userCredentials);