github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/c-deps/libroach/snapshot.cc (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  #include "snapshot.h"
    12  #include "encoding.h"
    13  #include "getter.h"
    14  #include "iterator.h"
    15  #include "status.h"
    16  
    17  namespace cockroach {
    18  
    19  DBSnapshot::~DBSnapshot() { rep->ReleaseSnapshot(snapshot); }
    20  
    21  DBStatus DBSnapshot::Put(DBKey key, DBSlice value) { return FmtStatus("unsupported"); }
    22  
    23  DBStatus DBSnapshot::Merge(DBKey key, DBSlice value) { return FmtStatus("unsupported"); }
    24  
    25  DBStatus DBSnapshot::Get(DBKey key, DBString* value) {
    26    rocksdb::ReadOptions read_opts;
    27    read_opts.snapshot = snapshot;
    28    DBGetter base(rep, read_opts, EncodeKey(key));
    29    return base.Get(value);
    30  }
    31  
    32  DBStatus DBSnapshot::Delete(DBKey key) { return FmtStatus("unsupported"); }
    33  
    34  DBStatus DBSnapshot::SingleDelete(DBKey key) { return FmtStatus("unsupported"); }
    35  
    36  DBStatus DBSnapshot::DeleteRange(DBKey start, DBKey end) { return FmtStatus("unsupported"); }
    37  
    38  DBStatus DBSnapshot::CommitBatch(bool sync) { return FmtStatus("unsupported"); }
    39  
    40  DBStatus DBSnapshot::ApplyBatchRepr(DBSlice repr, bool sync) { return FmtStatus("unsupported"); }
    41  
    42  DBSlice DBSnapshot::BatchRepr() { return ToDBSlice("unsupported"); }
    43  
    44  DBIterator* DBSnapshot::NewIter(DBIterOptions iter_options) {
    45    DBIterator* iter = new DBIterator(iters, iter_options);
    46    iter->read_opts.snapshot = snapshot;
    47    iter->rep.reset(rep->NewIterator(iter->read_opts));
    48    return iter;
    49  }
    50  
    51  DBStatus DBSnapshot::GetStats(DBStatsResult* stats) { return FmtStatus("unsupported"); }
    52  
    53  DBStatus DBSnapshot::GetTickersAndHistograms(DBTickersAndHistogramsResult* stats) {
    54    return FmtStatus("unsupported");
    55  }
    56  
    57  DBString DBSnapshot::GetCompactionStats() { return ToDBString("unsupported"); }
    58  
    59  DBStatus DBSnapshot::GetEnvStats(DBEnvStatsResult* stats) { return FmtStatus("unsupported"); }
    60  
    61  DBStatus DBSnapshot::GetEncryptionRegistries(DBEncryptionRegistries* result) {
    62    return FmtStatus("unsupported");
    63  }
    64  
    65  DBStatus DBSnapshot::EnvWriteFile(DBSlice path, DBSlice contents) {
    66    return FmtStatus("unsupported");
    67  }
    68  
    69  DBStatus DBSnapshot::EnvOpenFile(DBSlice path, uint64_t bytes_per_sync, rocksdb::WritableFile** file) {
    70    return FmtStatus("unsupported");
    71  }
    72  
    73  DBStatus DBSnapshot::EnvReadFile(DBSlice path, DBSlice* contents) {
    74    return FmtStatus("unsupported");
    75  }
    76  
    77  DBStatus DBSnapshot::EnvCloseFile(rocksdb::WritableFile* file) { return FmtStatus("unsupported"); }
    78  
    79  DBStatus DBSnapshot::EnvSyncFile(rocksdb::WritableFile* file) { return FmtStatus("unsupported"); }
    80  
    81  DBStatus DBSnapshot::EnvAppendFile(rocksdb::WritableFile* file, DBSlice contents) {
    82    return FmtStatus("unsupported");
    83  }
    84  
    85  DBStatus DBSnapshot::EnvDeleteFile(DBSlice path) { return FmtStatus("unsupported"); }
    86  
    87  DBStatus DBSnapshot::EnvDeleteDirAndFiles(DBSlice dir) { return FmtStatus("unsupported"); }
    88  
    89  DBStatus DBSnapshot::EnvLinkFile(DBSlice oldname, DBSlice newname) {
    90    return FmtStatus("unsupported");
    91  }
    92  
    93  DBStatus DBSnapshot::EnvOpenReadableFile(DBSlice path, rocksdb::RandomAccessFile** file) {
    94    return FmtStatus("unsupported");
    95  }
    96  DBStatus DBSnapshot::EnvReadAtFile(rocksdb::RandomAccessFile* file, DBSlice buffer, int64_t offset,
    97                                     int* n) {
    98    return FmtStatus("unsupported");
    99  }
   100  DBStatus DBSnapshot::EnvCloseReadableFile(rocksdb::RandomAccessFile* file) {
   101    return FmtStatus("unsupported");
   102  }
   103  DBStatus DBSnapshot::EnvOpenDirectory(DBSlice path, rocksdb::Directory** file) {
   104    return FmtStatus("unsupported");
   105  }
   106  DBStatus DBSnapshot::EnvSyncDirectory(rocksdb::Directory* file) { return FmtStatus("unsupported"); }
   107  DBStatus DBSnapshot::EnvCloseDirectory(rocksdb::Directory* file) {
   108    return FmtStatus("unsupported");
   109  }
   110  DBStatus DBSnapshot::EnvRenameFile(DBSlice oldname, DBSlice newname) {
   111    return FmtStatus("unsupported");
   112  }
   113  DBStatus DBSnapshot::EnvCreateDir(DBSlice name) { return FmtStatus("unsupported"); }
   114  DBStatus DBSnapshot::EnvDeleteDir(DBSlice name) { return FmtStatus("unsupported"); }
   115  DBStatus DBSnapshot::EnvListDir(DBSlice name, std::vector<std::string>* result) {
   116    return FmtStatus("unsupported");
   117  }
   118  
   119  }  // namespace cockroach