1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-18 13:54:11 +03:00

First cut of IOC::truncate(). Got some of the unit test

written.  Fixed some bugs.  Commented out the old truncate test
for now; depends on IOC::write() to extend a file.
This commit is contained in:
Patrick LeBlanc
2019-04-01 16:23:35 -05:00
parent d0aeffca07
commit b4ebf7c3c0
7 changed files with 232 additions and 51 deletions

View File

@@ -18,14 +18,14 @@ namespace storagemanager
{
struct metadataObject {
metadataObject();
metadataObject(uint64_t offset); // so we can search mObjects by integer
uint64_t offset;
mutable uint64_t length;
mutable std::string key;
bool operator < (const metadataObject &b) const { return offset < b.offset; }
};
class MetadataFile
{
public:
@@ -36,10 +36,11 @@ class MetadataFile
~MetadataFile();
bool exists() const;
void printObjects();
void printObjects() const;
int stat(struct stat *) const;
size_t getLength() const;
// returns the objects needed to update
std::vector<metadataObject> metadataRead(off_t offset, size_t length);
std::vector<metadataObject> metadataRead(off_t offset, size_t length) const;
// updates the metadatafile with new object
int writeMetadata(const char *filename);
@@ -47,6 +48,7 @@ class MetadataFile
void updateEntry(off_t offset, const std::string &newName, size_t newLength);
void updateEntryLength(off_t offset, size_t newLength);
metadataObject addMetadataObject(const char *filename, size_t length);
void removeEntry(off_t offset);
// TBD: this may have to go; there may be no use case where only the uuid needs to change.
static std::string getNewKeyFromOldKey(const std::string &oldKey, size_t length=0);