-
Notifications
You must be signed in to change notification settings - Fork 25
KVS new Design #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ahmed-Elsaka-JC
wants to merge
7
commits into
eclipse-score:main
Choose a base branch
from
Ahmed-Elsaka-JC:afe_new_uml_model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
KVS new Design #172
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
14e231d
proposed new design
Ahmed-Elsaka-JC 558cb58
new puml design
Ahmed-Elsaka-JC 0e91d66
update dio design
Ahmed-Elsaka-JC 698e7ff
update class diagram for kvs
Ahmed-Elsaka-JC f8831cf
fix review points
Ahmed-Elsaka-JC bccdd6a
fix review points
Ahmed-Elsaka-JC 868c5ca
fix review points
Ahmed-Elsaka-JC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| @startuml ScorePersistencyKvsDesign | ||
|
|
||
| ' Define color schemes matching original design | ||
| skinparam class { | ||
| BackgroundColor<<interface>> LightYellow | ||
| BorderColor<<interface>> DarkGoldenRod | ||
| BackgroundColor<<implementation>> LightBlue | ||
| BorderColor<<implementation>> DodgerBlue | ||
| BackgroundColor<<mock>> LightPink | ||
| BorderColor<<mock>> IndianRed | ||
| } | ||
|
|
||
| class KvsBuilder <<implementation>> { | ||
| - instance_id: InstanceId | ||
| - need_defaults : KvsDefaults | ||
| - need_kvs : KvsLoad | ||
| - backend: IStorageBackend | ||
| - {static} Kvs_pool : std::unordered_map<instanceId, std::shared_ptr<kvs> > | ||
| __ | ||
| + KvsBuilder(instance_id:InstanceId) | ||
| + NeedDefaultsFlag(flag:bool) : KvsBuilder& | ||
| + NeedKvsFlag(flag:bool) : KvsBuilder& | ||
| + Backend(backend:IStorageBackend) : KvsBuilder& | ||
| + Build() : std::shared_ptr<Kvs> | ||
| } | ||
|
|
||
|
|
||
|
|
||
| interface IStorageBackend <<interface>> { | ||
| + LoadKvs(instance_id:InstanceId, snapshot_id:SnapshotId):IKvs | ||
| + LoadDefault(instance_id:InstanceId):IKvs | ||
| + Flush(instance_id:InstanceId, kvs:unordered_map<string,kvs>):ResultBlank | ||
| + SnapshotCount(instance_id:InstanceId):Result<size_t> | ||
| + SnapshotRestore(instance_id:InstanceId, snapshot_id:SnapshotId):Kvs | ||
| + SnapshotMaxCount():Result<size_t> | ||
| } | ||
Ahmed-Elsaka-JC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| interface IKvs <<interface>> { | ||
| + Reset():ResultBlank | ||
| + ResetKey(key:string):ResultBlank | ||
| + GetAllKeys():Result<vector<string>> | ||
| + KeyExists(key:string):Result<bool> | ||
| + GetValue(key:string):Result<KvsValue> | ||
| + GetDefaultValue(key:string):Result<KvsValue> | ||
| + IsDefaultValue(key:string):Result<KvsValue> | ||
| + SetValue(key:string, value:KvsValue):ResultBlank | ||
| + RemoveKey(key:string):ResultBlank | ||
| + Flush():ResultBlank | ||
| + SnapshotCount():Result<size_t> | ||
| + SnapshotMaxCount():Result<size_t> | ||
| + SnapshotRestore(snapshot_id:SnapshotId):ResultBlank | ||
| + GetHashFilename(snapshot_id:SnapshotId):Result<filesystem::path> | ||
| } | ||
|
|
||
|
|
||
| IStorageBackend -[hidden]right- IKvs | ||
| IStorageBackend_Mock -[hidden]right- JsonBackend | ||
| JsonBackend -[hidden]right- IKvs_mock | ||
| IKvs_mock -[hidden]right- Kvs | ||
|
|
||
|
|
||
| class IStorageBackend_Mock <<mock>> { | ||
| + LoadKvs(instance_id:InstanceId, snapshot_id:SnapshotId):IKvs | ||
| + LoadDefault(instance_id:InstanceId):IKvs | ||
| + Flush(instance_id:InstanceId, kvs:unordered_map<string,kvs>):ResultBlank | ||
| + SnapshotCount(instance_id:InstanceId):Result<size_t> | ||
| + SnapshotRestore(instance_id:InstanceId, snapshot_id:SnapshotId):Kvs | ||
| + SnapshotMaxCount():Result<size_t> | ||
| } | ||
|
|
||
| class JsonBackend <<implementation>> { | ||
| - Instance_id: InstanceId | ||
| - filename_prefix : score::filesystem::path | ||
| - filesystem : score::filesystem | ||
| - parser : unique_ptr<IjsonParser> parser | ||
| - writer : unique_ptr<IjsonWriter> writer | ||
| - directory : string | ||
| - max_snapshot_count : size_t | ||
| __ | ||
| + JsonBackend(instance_id:InstanceId, filename_prefix:score::filesystem::path, filesystem:score::filesystem, directory:string, max_snapshot_count:size_t) | ||
| + LoadKvs(instance_id:InstanceId, snapshot_id:SnapshotId):IKvs | ||
| + LoadDefault(instance_id:InstanceId):IKvs | ||
| + Flush(instance_id:InstanceId, kvs:unordered_map<string,kvs>):ResultBlank | ||
| + SnapshotCount(instance_id:InstanceId):Result<size_t> | ||
| + SnapshotRestore(instance_id:InstanceId, snapshot_id:SnapshotId):Kvs | ||
| + GetHashFilename(snapshot_id:SnapshotId):Result<filesystem::path> | ||
| + Dir(dir_path:string):ResultBlank | ||
| + SnapshotMaxCount():Result<size_t> | ||
|
|
||
| } | ||
|
|
||
| class IKvs_mock <<mock>> { | ||
Ahmed-Elsaka-JC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| + Reset():ResultBlank | ||
| + ResetKey(key:string):ResultBlank | ||
| + GetAllKeys():Result<vector<string>> | ||
| + KeyExists(key:string):Result<bool> | ||
| + GetValue(key:string):Result<KvsValue> | ||
| + GetDefaultValue(key:string):Result<KvsValue> | ||
| + IsDefaultValue(key:string):Result<bool> | ||
| + SetValue(key:string, value:KvsValue):ResultBlank | ||
| + RemoveKey(key:string):ResultBlank | ||
| + Flush():ResultBlank | ||
| + SnapshotCount():Result<size_t> | ||
| + SnapshotMaxCount():Result<size_t> | ||
| + SnapshotRestore(snapshot_id:SnapshotId):ResultBlank | ||
| + GetHashFilename(snapshot_id:SnapshotId):Result<filesystem::path> | ||
| } | ||
|
|
||
| class Kvs <<implementation>> { | ||
Ahmed-Elsaka-JC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| + kvs : unordered_map<string, KvsValue> | ||
| + default_kvs : unordered_map<string, KvsValue> | ||
| + logger : unique_ptr<mw::log::logger> logger | ||
| + Storage_backend : IStorageBackend | ||
| __ | ||
| + Reset():ResultBlank | ||
| + ResetKey(key:string):Result<bool> | ||
| + GetAllKeys():Result<vector<string>> | ||
| + KeyExists(key:string):Result<bool> | ||
| + GetValue(key:string):Result<KvsValue> | ||
| + GetDefaultValue(key:string):Result<KvsValue> | ||
| + IsDefaultValue(key:string):Result<bool> | ||
| + SetValue(key:string, value:KvsValue):ResultBlank | ||
| + RemoveKey(key:string):ResultBlank | ||
| + Flush():ResultBlank | ||
| + SnapshotCount():Result<size_t> | ||
| + SnapshotMaxCount():Result<size_t> | ||
| + SnapshotRestore(snapshot_id:SnapshotId):ResultBlank | ||
| + GetHashFilename(snapshot_id:SnapshotId):Result<filesystem::path> | ||
| } | ||
|
|
||
| ' Relationships | ||
| IStorageBackend_Mock -up-|> IStorageBackend : implements | ||
| JsonBackend -up-|> IStorageBackend : implements | ||
| IKvs_mock -up-|> IKvs : implements | ||
| Kvs -up-|> IKvs : implements | ||
|
|
||
| ' Dependencies | ||
| KvsBuilder ..> IStorageBackend : uses | ||
| KvsBuilder ..> IKvs : uses | ||
| IStorageBackend *-- IKvs : Composes | ||
|
|
||
|
|
||
| @enduml | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*.puml files itself will never be rendered. You need to reference it in any other .rst file as