/*
 * Prepares for removal from one level of the hierarchy.  The caller must
 * call delete_at() to remove the entry at index.
 */
static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info,
		      struct dm_btree_value_type *vt, dm_block_t root,
		      uint64_t key, unsigned *index)
{
	int i = *index, r;
	struct btree_node *n;

	for (;;) {
		r = shadow_step(s, root, vt);
		if (r < 0)
			break;

		/*
		 * We have to patch up the parent node, ugly, but I don't
		 * see a way to do this automatically as part of the spine
		 * op.
		 */
		if (shadow_has_parent(s)) {
			__le64 location = cpu_to_le64(dm_block_location(shadow_current(s)));
			memcpy(value_ptr(dm_block_data(shadow_parent(s)), i),
			       &location, sizeof(__le64));
		}

		n = dm_block_data(shadow_current(s));

		if (le32_to_cpu(n->header.flags) & LEAF_NODE)
			return do_leaf(n, key, index);

		r = rebalance_children(s, info, vt, key);
		if (r)
			break;

		n = dm_block_data(shadow_current(s));
		if (le32_to_cpu(n->header.flags) & LEAF_NODE)
			return do_leaf(n, key, index);

		i = lower_bound(n, key);

		/*
		 * We know the key is present, or else
		 * rebalance_children would have returned
		 * -ENODATA
		 */
		root = value64(n, i);
	}

	return r;
}
Beispiel #2
0
folly::Future<folly::Unit> MyLeafAsyncClient::future_do_leaf(apache::thrift::RpcOptions& rpcOptions) {
  folly::Promise<folly::Unit> promise9;
  auto future10 = promise9.getFuture();
  std::unique_ptr<apache::thrift::RequestCallback> callback11(new apache::thrift::FutureCallback<folly::Unit>(std::move(promise9), recv_wrapped_do_leaf, channel_));
  do_leaf(rpcOptions, std::move(callback11));
  return std::move(future10);
}
Beispiel #3
0
void MyLeafAsyncClient::sync_do_leaf(apache::thrift::RpcOptions& rpcOptions) {
  apache::thrift::ClientReceiveState _returnState;
  std::unique_ptr<apache::thrift::RequestCallback> callback8(new apache::thrift::ClientSyncCallback(&_returnState, getChannel()->getEventBase(), false));
  do_leaf(rpcOptions, std::move(callback8));
  getChannel()->getEventBase()->loopForever();
  if (!_returnState.buf()) {
    assert(_returnState.exception());
    std::rethrow_exception(_returnState.exception());
  }
  recv_do_leaf(_returnState);
}
Beispiel #4
0
int
main(int argc, char **argv)
{
    int depth;

    if (argc != 2) {
	fprintf(stderr, "Usage:  pyramid recursion\n");
	return 1;
    }
    depth = atoi(argv[1]);
    sin60 = sin(60.0 * DEG2RAD);

    outfp = wdb_fopen("pyramid.g");

    mk_id(outfp, "3-D Pyramids");

    do_leaf("leaf");
    do_tree("tree", "leaf", depth);

    return 0;
}
Beispiel #5
0
int
main(int argc, char **argv)
{
    int depth;

    if (argc != 2 || BU_STR_EQUAL(argv[1],"-h") || BU_STR_EQUAL(argv[1],"-?")) {
	fprintf(stderr, "Usage: pyramid recursion\n      (the argument is of type integer)\n");
	return 1;
    }
    depth = atoi(argv[1]);
    sin60 = sin(60.0 * DEG2RAD);

    outfp = wdb_fopen("pyramid.g");
    printf("Creating file pyramid.g\n");

    mk_id(outfp, "3-D Pyramids");

    do_leaf("leaf");
    do_tree("tree", "leaf", depth);

    return 0;
}
Beispiel #6
0
folly::Future<folly::Unit> MyLeafSvIf::future_do_leaf() {
  return apache::thrift::detail::si::future([&] { return do_leaf(); });
}
Beispiel #7
0
void MyLeafAsyncClient::do_leaf(std::function<void (::apache::thrift::ClientReceiveState&&)> callback) {
  do_leaf(std::unique_ptr<apache::thrift::RequestCallback>(new apache::thrift::FunctionReplyCallback(std::move(callback))));
}
Beispiel #8
0
void MyLeafAsyncClient::do_leaf(std::unique_ptr<apache::thrift::RequestCallback> callback) {
  ::apache::thrift::RpcOptions rpcOptions;
  do_leaf(rpcOptions, std::move(callback));
}