예제 #1
0
hrbytes ClearOperation::executeOperation(infinispan::hotrod::transport::Transport& transport)
{
    hr_scoped_ptr<HeaderParams> params(&(RetryOnFailureOperation<hrbytes>::writeHeader(transport, CLEAR_REQUEST)));
    transport.flush();
    RetryOnFailureOperation<hrbytes>::readHeaderAndValidate(transport, *params);
    return hrbytes();
}
예제 #2
0
bool IsCounterDefinedOperation::executeOperation(infinispan::hotrod::transport::Transport& transport) {
    TRACE("Executing IsCounterDefinedOperation(flags=%u)", flags);
    std::unique_ptr<HeaderParams> params(RetryOnFailureOperation<bool>::writeHeader(transport, COUNTER_CREATE_REQUEST));
    writeName(transport, counterName);
    transport.flush();
    uint8_t status = readHeaderAndValidate(transport, *params);
    TRACE("Finished IsCounterDefinedOperation");
    return status==0x00;
}
예제 #3
0
bool RemoveCounterListenerOperation::executeOperation(infinispan::hotrod::transport::Transport& transport) {
    TRACE("Executing RemoveCounterListenerOperation(flags=%u)", flags);
    std::unique_ptr<HeaderParams> params(
            RetryOnFailureOperation<bool>::writeHeader(transport, COUNTER_REMOVE_LISTENER_REQUEST));
    writeName(transport, counterName);
    transport.writeArray(listenerId);
    transport.flush();
    uint8_t status = readHeaderAndValidate(transport, *params);
    return status == NO_ERROR_STATUS;
}
예제 #4
0
void RemoveCounterOperation::executeOperation(infinispan::hotrod::transport::Transport& transport) {
    TRACE("Executing RemoveOperation(flags=%u)", flags);
    std::unique_ptr<HeaderParams> params(RetryOnFailureOperation<void>::writeHeader(transport, COUNTER_REMOVE_REQUEST));
    writeName(transport, counterName);
    transport.flush();
    uint8_t status = readHeaderAndValidate(transport, *params);
    if (!isSuccess(status) && status != KEY_DOES_NOT_EXIST_STATUS) {
        throw HotRodClientException(
                std::string("Error in CounterRemove operation, counter name: ") + counterName + " status: "
                        + std::to_string(status));
    }
    TRACE("Finished RemoveOperation");
}
예제 #5
0
long GetCounterValueOperation::executeOperation(infinispan::hotrod::transport::Transport& transport) {
    TRACE("Executing IsCounterDefinedOperation(flags=%u)", flags);
    std::unique_ptr<HeaderParams> params(RetryOnFailureOperation<long>::writeHeader(transport, COUNTER_GET_REQUEST));
    writeName(transport, counterName);
    transport.flush();
    uint8_t status = readHeaderAndValidate(transport, *params);
    if (!isSuccess(status)) {
        throw HotRodClientException(
                std::string("Error in GetCountervalue operation, counter name: ") + counterName + " status: "
                        + std::to_string(status));
    }
    auto ret = (long)transport.readLong();
    TRACE("Finished IsCounterDefinedOperation");
    return ret;
}
예제 #6
0
long CompareAndSwapCounterValueOperation::executeOperation(infinispan::hotrod::transport::Transport& transport) {
    TRACE("Executing CompareAndSwapOperation(flags=%u)", flags);
    std::unique_ptr<HeaderParams> params(RetryOnFailureOperation<long>::writeHeader(transport, COUNTER_CAS_REQUEST));
    writeName(transport, counterName);
    transport.writeLong(expect);
    transport.writeLong(update);
    transport.flush();
    uint8_t status = readHeaderAndValidate(transport, *params);
    assertBoundaries(status);
    if (status != NO_ERROR_STATUS) {
        throw HotRodClientException(
                std::string("Error in CompareAndSwap operation, counter name: ") + counterName + " status: "
                        + std::to_string(status));
    }
    auto ret = (long)transport.readLong();
    TRACE("Finished CompareAndSwapDefinedOperation");
    return ret;
}