Skip to content

Commit

Permalink
fixes typo s/Avalaible/Available/g
Browse files Browse the repository at this point in the history
  • Loading branch information
fsaintjacques committed Jul 27, 2015
1 parent 2f9c9b3 commit 4b3bd84
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions disruptor/claim_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ClaimStrategy {
// @param dependents dependents sequences to wait on (mostly consumers).
//
// @return last claimed sequence.
bool HasAvalaibleCapacity(const std::vector<Sequence*>& dependents);
bool HasAvailableCapacity(const std::vector<Sequence*>& dependents);
void SynchronizePublishing(const int64_t& sequence, const Sequence& cursor,
const size_t& delta) {}
Expand Down Expand Up @@ -85,7 +85,7 @@ class SingleThreadedStrategy {
return next_sequence;
}

bool HasAvalaibleCapacity(const std::vector<Sequence*>& dependents) {
bool HasAvailableCapacity(const std::vector<Sequence*>& dependents) {
const int64_t wrap_point = last_claimed_sequence_ + 1L - N;
if (wrap_point > last_consumer_sequence_) {
const int64_t min_sequence = GetMinimumSequence(dependents);
Expand Down Expand Up @@ -126,7 +126,7 @@ class MultiThreadedStrategy {
return next_sequence;
}

bool HasAvalaibleCapacity(const std::vector<Sequence*>& dependents) {
bool HasAvailableCapacity(const std::vector<Sequence*>& dependents) {
const int64_t wrap_point = last_claimed_sequence_.sequence() + 1L - N;
if (wrap_point > last_consumer_sequence_.sequence()) {
const int64_t min_sequence = GetMinimumSequence(dependents);
Expand Down
6 changes: 3 additions & 3 deletions disruptor/event_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ class BatchEventProcessor : public EventProcessorInterface<T> {

while (true) {
try {
int64_t avalaible_sequence = sequence_barrier_->WaitFor(next_sequence);
int64_t available_sequence = sequence_barrier_->WaitFor(next_sequence);

while (next_sequence <= avalaible_sequence) {
while (next_sequence <= available_sequence) {
event = ring_buffer_->Get(next_sequence);
event_handler_->OnEvent(next_sequence,
next_sequence == avalaible_sequence, event);
next_sequence == available_sequence, event);
next_sequence++;
}

Expand Down
4 changes: 2 additions & 2 deletions disruptor/sequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class Sequencer {
// of available capacity.
//
// @return true if the buffer has the capacity to allocated another event.
bool HasAvalaibleCapacity() {
return claim_strategy_.HasAvalaibleCapacity(gating_sequences_);
bool HasAvailableCapacity() {
return claim_strategy_.HasAvailableCapacity(gating_sequences_);
}

// Claim the next batch of sequence numbers for publishing.
Expand Down
12 changes: 6 additions & 6 deletions test/claim_strategy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ BOOST_AUTO_TEST_CASE(IncrementAndGet) {
BOOST_CHECK_EQUAL(return_value, kFirstSequenceValue + delta);
}

BOOST_AUTO_TEST_CASE(HasAvalaibleCapacity) {
BOOST_AUTO_TEST_CASE(HasAvailableCapacity) {
auto one_dependents = oneDependents();

int64_t return_value =
strategy.IncrementAndGet(one_dependents, RING_BUFFER_SIZE);
BOOST_CHECK_EQUAL(return_value, kInitialCursorValue + RING_BUFFER_SIZE);
BOOST_CHECK_EQUAL(strategy.HasAvalaibleCapacity(one_dependents), false);
BOOST_CHECK_EQUAL(strategy.HasAvailableCapacity(one_dependents), false);

// advance late consumers
sequence_1.IncrementAndGet(1L);
BOOST_CHECK_EQUAL(strategy.HasAvalaibleCapacity(one_dependents), true);
BOOST_CHECK_EQUAL(strategy.HasAvailableCapacity(one_dependents), true);

// only one slot free
BOOST_CHECK_EQUAL(strategy.IncrementAndGet(one_dependents),
Expand Down Expand Up @@ -133,17 +133,17 @@ BOOST_AUTO_TEST_CASE(DualIncrementAndGet) {
BOOST_CHECK_EQUAL(return_2, kFirstSequenceValue + 1L);
}

BOOST_AUTO_TEST_CASE(HasAvalaibleCapacity) {
BOOST_AUTO_TEST_CASE(HasAvailableCapacity) {
auto one_dependents = oneDependents();

int64_t return_value =
strategy.IncrementAndGet(one_dependents, RING_BUFFER_SIZE);
BOOST_CHECK_EQUAL(return_value, kInitialCursorValue + RING_BUFFER_SIZE);
BOOST_CHECK_EQUAL(strategy.HasAvalaibleCapacity(one_dependents), false);
BOOST_CHECK_EQUAL(strategy.HasAvailableCapacity(one_dependents), false);

// advance late consumers
sequence_1.IncrementAndGet(1L);
BOOST_CHECK_EQUAL(strategy.HasAvalaibleCapacity(one_dependents), true);
BOOST_CHECK_EQUAL(strategy.HasAvailableCapacity(one_dependents), true);

// only one slot free
BOOST_CHECK_EQUAL(strategy.IncrementAndGet(one_dependents),
Expand Down

0 comments on commit 4b3bd84

Please sign in to comment.