Skip to content

Commit

Permalink
added __pycache__/ to git ignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharan-devarajan committed Jan 13, 2021
1 parent 226fab9 commit e2170dd
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions src/api/bucket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <iostream>
#include <vector>

#include "utils.h"
#include "buffer_pool.h"
#include "metadata_management.h"
#include "utils.h"

namespace hermes {

Expand Down Expand Up @@ -57,8 +57,8 @@ Status Bucket::Put(const std::string &name, const u8 *data, size_t size,
}
ret = PlaceBlobs(schemas, blobs, names);
} else {
SwapBlob swap_blob =
PutToSwap(&hermes_->context_, &hermes_->rpc_, name, id_, data, size);
SwapBlob swap_blob = PutToSwap(&hermes_->context_, &hermes_->rpc_, name,
id_, data, size);
TriggerBufferOrganizer(&hermes_->rpc_, kPlaceInHierarchy, name, swap_blob,
ctx.buffer_organizer_retries);
ret = 0;
Expand All @@ -76,12 +76,12 @@ size_t Bucket::GetBlobSize(Arena *arena, const std::string &name,
size_t result = 0;

if (IsValid()) {
LOG(INFO) << "Getting Blob " << name << " size from bucket " << name_
<< '\n';
BlobID blob_id =
GetBlobIdByName(&hermes_->context_, &hermes_->rpc_, name.c_str());
result =
GetBlobSizeById(&hermes_->context_, &hermes_->rpc_, arena, blob_id);
LOG(INFO) << "Getting Blob " << name << " size from bucket "
<< name_ << '\n';
BlobID blob_id = GetBlobIdByName(&hermes_->context_, &hermes_->rpc_,
name.c_str());
result = GetBlobSizeById(&hermes_->context_, &hermes_->rpc_, arena,
blob_id);
}

return result;
Expand All @@ -100,8 +100,8 @@ size_t Bucket::Get(const std::string &name, Blob &user_blob, Context &ctx) {
ret = GetBlobSize(scratch, name, ctx);
} else {
LOG(INFO) << "Getting Blob " << name << " from bucket " << name_ << '\n';
BlobID blob_id =
GetBlobIdByName(&hermes_->context_, &hermes_->rpc_, name.c_str());
BlobID blob_id = GetBlobIdByName(&hermes_->context_, &hermes_->rpc_,
name.c_str());
ret = ReadBlobById(&hermes_->context_, &hermes_->rpc_,
&hermes_->trans_arena_, user_blob, blob_id);
}
Expand All @@ -110,7 +110,7 @@ size_t Bucket::Get(const std::string &name, Blob &user_blob, Context &ctx) {
return ret;
}

template <class Predicate>
template<class Predicate>
Status Bucket::GetV(void *user_blob, Predicate pred, Context &ctx) {
(void)user_blob;
(void)ctx;
Expand All @@ -132,7 +132,8 @@ Status Bucket::DeleteBlob(const std::string &name, Context &ctx) {
}

Status Bucket::RenameBlob(const std::string &old_name,
const std::string &new_name, Context &ctx) {
const std::string &new_name,
Context &ctx) {
(void)ctx;
Status ret = 0;

Expand All @@ -148,30 +149,31 @@ Status Bucket::RenameBlob(const std::string &old_name,
}

bool Bucket::ContainsBlob(const std::string &name) {
bool result =
hermes::ContainsBlob(&hermes_->context_, &hermes_->rpc_, id_, name);
bool result = hermes::ContainsBlob(&hermes_->context_, &hermes_->rpc_, id_,
name);

return result;
}

bool Bucket::BlobIsInSwap(const std::string &name) {
BlobID blob_id =
GetBlobIdByName(&hermes_->context_, &hermes_->rpc_, name.c_str());
BlobID blob_id = GetBlobIdByName(&hermes_->context_, &hermes_->rpc_,
name.c_str());
bool result = hermes::BlobIsInSwap(blob_id);

return result;
}

template <class Predicate>
std::vector<std::string> Bucket::GetBlobNames(Predicate pred, Context &ctx) {
template<class Predicate>
std::vector<std::string> Bucket::GetBlobNames(Predicate pred,
Context &ctx) {
(void)ctx;

LOG(INFO) << "Getting blob names by predicate from bucket " << name_ << '\n';
auto blob_names = std::vector<std::string>();
return blob_names;

return std::vector<std::string>();
}

struct bkt_info *Bucket::GetInfo(Context &ctx) {
struct bkt_info * Bucket::GetInfo(Context &ctx) {
(void)ctx;
struct bkt_info *ret = nullptr;

Expand Down Expand Up @@ -203,9 +205,9 @@ Status Bucket::Persist(const std::string &file_name, Context &ctx) {
std::string open_mode = "w";

// TODO(chogan): Support other storage backends
Status result =
StdIoPersistBucket(&hermes_->context_, &hermes_->rpc_,
&hermes_->trans_arena_, id_, file_name, open_mode);
Status result = StdIoPersistBucket(&hermes_->context_, &hermes_->rpc_,
&hermes_->trans_arena_, id_, file_name,
open_mode);

return result;
}
Expand All @@ -229,8 +231,8 @@ Status Bucket::Destroy(Context &ctx) {

if (IsValid()) {
LOG(INFO) << "Destroying bucket '" << name_ << "'" << std::endl;
bool destroyed =
DestroyBucket(&hermes_->context_, &hermes_->rpc_, name_.c_str(), id_);
bool destroyed = DestroyBucket(&hermes_->context_, &hermes_->rpc_,
name_.c_str(), id_);
if (destroyed) {
id_.as_int = 0;
} else {
Expand Down

0 comments on commit e2170dd

Please sign in to comment.