コード例 #1
0
 virtual void Write(const KeyT& key, const ValueT& value) {
   key_buffer_.clear();
   value_buffer_.clear();
   // Serialize the key/value pair.
   StringOutputStream key_out(&key_buffer_);
   StringOutputStream value_out(&value_buffer_);
   SerializationHandler<KeyT>::Serialize(&key, &key_out);
   SerializationHandler<ValueT>::Serialize(&value, &value_out);
   // Write them using the RawRecordWriter.
   raw_writer_->Write(key_buffer_, value_buffer_);
 }
コード例 #2
0
ファイル: firelocator.cpp プロジェクト: mempko/firestr
void create_new_key(const std::string& key, const std::string& pass)
{
    auto k = std::make_shared<sc::private_key>(pass);
    CHECK(k);

    std::ofstream key_out(key.c_str(), std::fstream::out | std::fstream::binary);
    if(!key_out.good()) 
        throw std::runtime_error{"unable to save `" + key + "'"};

    sc::encode(key_out, *k);
}