当前位置: 首页>>代码示例>>Java>>正文


Java WriteResult类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:elder-oss,项目名称:sourcerer,代码行数:35,代码来源:EventStoreEsjcEventRepository.java

示例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;
}
 
开发者ID:msemys,项目名称:esjc,代码行数:9,代码来源:CommitTransactionOperation.java

示例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;
}
 
开发者ID:msemys,项目名称:esjc,代码行数:13,代码来源:AppendToStreamOperation.java

示例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));
}
 
开发者ID:msemys,项目名称:esjc,代码行数:7,代码来源:CommitTransactionOperation.java

示例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));
}
 
开发者ID:msemys,项目名称:esjc,代码行数:7,代码来源:AppendToStreamOperation.java

示例6: commit

import com.github.msemys.esjc.WriteResult; //导入依赖的package包/类
CompletableFuture<WriteResult> commit(Transaction transaction, UserCredentials userCredentials); 
开发者ID:msemys,项目名称:esjc,代码行数:2,代码来源:TransactionManager.java


注:本文中的com.github.msemys.esjc.WriteResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。