generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data below a threshold should not be stored in DataStore. (#456)
* add encodedData field to RecordsWrite in message storage under a threshold In this commit I've added utilized the existing RecordsWriteMessageWithOptionalEncodedData class to leverage writing data from RecordsWrite messages directly into the MessageStore when the data is below the 50k byte threshold. For now I'm still storing in DataStore, but that will be removed in subsequent commits. I had to take care and remove `encodedData` from messages when computing the CID and made sure to use the Message.getCid() helper for computing CIDs for message storage. Additionally, I've made sure to prune the original RecordsWrite of any encodedData when cleanup happens. * do not store data smaller tahn a threshold in the DataStore In this commit I've built on the previous one by not storing data larger than the treshold within the DataStore and keepign it only embedded within the MessageStore. I've imicked the sareguards and errors from putData into processEncodedData taking into account encodedData. I've also implemented tests for various data sizes in certain places where I noticed it may matter. I'm missing some additional tests that I will write in subsequent commits. * added tests for MessagesGet and for Message getCid * fixed broken tests that weren't running, added tests to check paths between putData and processEncodedData * fix tests that weren't running * more coverage for records-read * be explicit when testing for thresholds * refactor validation of data * remove backward compatibile code, update tests * remove unneeded tests for backward compatibilty * remove storage controller query method, replace it with messageStore querymethod * remove unneeded comment about storage controller from * comments and variables for clarity * comments for further clarity around encodedData * readme update after rebase
- Loading branch information
1 parent
03066e5
commit b2927e6
Showing
15 changed files
with
640 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export class DwnConstant { | ||
/** | ||
* The maximum size in bytes of raw data that will be returned as `encodedData`. | ||
* this is also the maximum size that we will store within MessageStore. | ||
*/ | ||
public static readonly maxDataSizeAllowedToBeEncoded = 10_000; | ||
public static readonly maxDataSizeAllowedToBeEncoded = 50_000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.