Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

add KV Table iterator bool operator #987

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ else # Linux
if [[ $BUILDKITE == true ]]; then
# Generate Base Images
$CICD_DIR/generate-base-images.sh
if [[ "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then
FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop'
fi
fi

COMMANDS="$PRE_COMMANDS && $BUILD_COMMANDS"
Expand Down
7 changes: 6 additions & 1 deletion .cicd/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ if [[ -f $BUILDKITE_ENV_FILE ]]; then
evars="$evars --env ${var%%=*}"
done < "$BUILDKITE_ENV_FILE"
fi

if [[ "$BUILDKITE" == 'true' && "$IMAGE_TAG" == 'ubuntu-18.04' ]]; then
FULL_TAG='eosio/ci-contracts-builder:base-ubuntu-18.04-develop'
fi

set +e
eval docker run $ARGS $evars $IMAGE_TAG bash -c \"$COMMANDS\"
eval docker run $ARGS $evars $FULL_TAG bash -c \"$COMMANDS\"
EXIT_STATUS=$?

# buildkite
Expand Down
4 changes: 2 additions & 2 deletions .cicd/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ steps:
- "./.cicd/build-integration.sh"
- "tar -pczf build.tar.gz build && buildkite-agent artifact upload build.tar.gz"
env:
IMAGE_TAG: "eosio/ci-contracts-builder:base-ubuntu-18.04-develop"
IMAGE_TAG: "ubuntu-18.04"
agents:
queue: "automation-eks-eos-builder-fleet"
timeout: ${TIMEOUT:-60}
Expand Down Expand Up @@ -321,7 +321,7 @@ steps:
- "buildkite-agent artifact download build.tar.gz . --step ':ubuntu: Ubuntu 18.04 - Build' --agent-access-token $$BUILDKITE_AGENT_ACCESS_TOKEN && tar -xzf build.tar.gz"
- "./.cicd/integration-tests.sh"
env:
IMAGE_TAG: "eosio/ci-contracts-builder:base-ubuntu-18.04-develop"
IMAGE_TAG: "ubuntu-18.04"
agents:
queue: "automation-eks-eos-tester-fleet"
timeout: ${TIMEOUT:-10}
Expand Down
6 changes: 6 additions & 0 deletions libraries/eosiolib/contracts/eosio/key_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ namespace internal {
return eosio::key_type{(char*)buffer, actual_value_size};
}

bool valid() const { return itr_stat == status::iterator_ok; }

protected:
uint32_t itr;
status itr_stat;
Expand Down Expand Up @@ -587,6 +589,10 @@ class table : internal::table_base {
bool operator>=(const iterator& b) const {
return base_iterator::compare(b) >= 0;
}

explicit operator bool() const {
return this->valid();
}
};

class reverse_iterator : public base_iterator {
Expand Down