Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ load("@rules_rust//rust:defs.bzl", "rust_clippy")
load("@score_docs_as_code//:docs.bzl", "docs")
load("@score_tooling//:defs.bzl", "cli_helper", "copyright_checker", "dash_license_checker", "setup_starpls", "use_format_targets")
load("//:project_config.bzl", "PROJECT_CONFIG")
load("@score_tooling//bazel/rules/score_module:score_module.bzl",
"sphinx_module",
"architectural_design",
"assumptions_of_use",
"component_requirements",
"dependability_analysis",
"feature_requirements",
"safety_analysis",
"score_component")


# Creates all documentation targets:
# - `:docs` for building documentation at build-time
Expand All @@ -26,6 +36,81 @@ docs(
source_dir = "docs",
)

sphinx_module(
name = "persistency_module_doc",
srcs = glob(
[
"docs/**/*.rst",
"docs/**/*.puml",
],
allow_empty = True,
),
index = "docs/index.rst",
visibility = ["//visibility:public"],
deps = [
"@score_process//:score_process_module",
"@score_platform//:score_platform_module",
],
)

# ============================================================================
# KVS Component Artifacts
# ============================================================================

assumptions_of_use(
name = "kvs_assumptions_of_use",
srcs = ["docs/persistency/docs/manual/safety_manual.rst"],
)

component_requirements(
name = "kvs_component_requirements",
srcs = ["docs/persistency/kvs/docs/requirements/requirements.rst"],
)

architectural_design(
name = "kvs_architectural_design",
static = ["docs/persistency/kvs/docs/architecture/static_architecture.rst"] + glob(["docs/persistency/kvs/docs/architecture/_assets/*.puml"]),
dynamic = ["docs/persistency/kvs/docs/architecture/dynamic_architecture.rst"],
)

safety_analysis(
name = "kvs_safety_analysis",
failuremodes = ["docs/persistency/kvs/docs/safety_analysis/fmea.rst"],
)

dependability_analysis(
name = "kvs_dependability_analysis",
safety_analysis = [":kvs_safety_analysis"],
dfa = ["docs/persistency/kvs/docs/safety_analysis/dfa.rst"],
fmea = ["docs/persistency/kvs/docs/safety_analysis/fmea.rst"],
arch_design = ":kvs_architectural_design",
)

# ============================================================================
# KVS Score Component (SEooC)
# ============================================================================

score_component(
name = "persistency_kvs",
description = """
The Key-Value Store (KVS) component provides persistent storage capabilities
for safety-critical applications. It offers a simple interface for storing
and retrieving key-value pairs with support for data integrity, versioning,
and fail-safe operations.
""",
assumptions_of_use = [":kvs_assumptions_of_use"],
component_requirements = [":kvs_component_requirements"],
architectural_design = [":kvs_architectural_design"],
dependability_analysis = [":kvs_dependability_analysis"],
sphinx = "@score_tooling//bazel/rules/score_module:score_build",
visibility = ["//visibility:public"],
deps = [
"@score_process//:score_process_module",
"@score_platform//:score_platform_module",
],
)


setup_starpls(
name = "starpls_server",
visibility = ["//visibility:public"],
Expand Down
10 changes: 7 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ bazel_dep(name = "score_process", version = "1.3.2")
bazel_dep(name = "score_python_basics", version = "0.3.4")
bazel_dep(name = "score_tooling", version = "1.0.3")

# ToDo: remove this once 1.0.4 is released,
# since it will contain updated cr_checker
git_override(
module_name = "score_tooling",
commit = "654664dae7df2700fd5840c5ed6c07ac6c61705d", #until 1.0.4 is released
commit = "b5b182dd9c1ed72b3f70939a72488d135645e5b5",
remote = "https://github.com/eclipse-score/tooling.git",
)

git_override(
module_name = "score_docs_as_code",
commit = "5af3382025784130f91fed0767091997073911ca",
remote = "https://github.com/eclipse-score/docs-as-code.git",
)

# ToDo: implicit dependencies for score_tooling, but needed directly here??
bazel_dep(name = "aspect_rules_lint", version = "1.10.2")
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@startuml

title Sequence Diagram: Build KVS Instance

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Create KVS builder
kvs --> actor: KVS builder instance

actor -> kvs: Set need_defaults flag
kvs --> actor: KVS builder instance

actor -> kvs: Set need_kvs flag
kvs --> actor: KVS builder instance

actor -> kvs: Build KVS instance

alt kvs-builder-success
kvs --> actor: KVS instance with builder config
else kvs-builder-error
kvs --> actor: KVS ErrorCode
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml

title Sequence Diagram: Check if Key contains Default Value

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Does key have default value

alt default-key-exists
alt key-exists
alt default-and-key-match
kvs --> actor: Key contains default value
else key-doesnt-exist
kvs --> actor: Key doesn't containt default value
end
else key-doesnt-exist
kvs --> actor: Key contains default value
end
else default-doesnt-exist
kvs --> actor: Key doesn't contain default value
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml

title Sequence Diagram: Delete Key from KVS Instance

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Remove key

alt key-exists
kvs --> actor: Successfully deleted key
else key-doesnt-exist
kvs --> actor: Key-Not-Found-Error
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@startuml

title Sequence Diagram: Flush Local Representation to Data File

participant "User" as actor
participant "«component» :kvs" as kvs
participant "«component» :json" as json_parser
participant "«component» :fs" as fs

actor -> kvs: Flush KVS

kvs -> json_parser: Generate string from local representation

alt json-string
json_parser --> kvs: JSON data string
else json-string-error
json_parser --> kvs: JSON generator error
kvs --> actor: JSON generator error
end

kvs -> kvs: Rotate snapshots

alt snapshot-rotate-success
kvs --> kvs: Snapshots rotated
else snapshot-rotate-error
kvs --> actor: Snapshot-Rotate-Error
end

kvs -> kvs: Create JSON data hash

alt hash-created-success
kvs -> kvs: Data hash
else hash-create-error
kvs --> actor: Hash-Calc-Error
end

kvs -> fs: Write JSON data string to file

alt file-write
fs --> kvs: File successfully written
else file-write-error
fs --> kvs: File-Write-Error
kvs --> actor: File-Write-Error
end

kvs -> fs: Write JSON data hash to file

alt file-hash-write
fs --> kvs: Hash file successfully written
kvs --> actor: Flush successful
else file-hash-write-error
fs --> kvs: File-Hash-Write-Error
kvs --> actor: File-Hash-Write-Error
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@startuml

title Sequence Diagram: Read Key from KVS Instance

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Get value for key

alt key-exists
kvs --> actor: Return value for key
else key-doesnt-exist
alt default-exists
kvs --> actor: Return default value for key
else default-doesnt-exist
kvs --> actor: Key-Not-Found error
end
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@startuml

title Sequence Diagram: Read Data into Local Representation (KvsValue)

participant "User" as actor
participant "«component» :kvs" as kvs
participant "«component» :json" as json_parser
participant "«component» :fs" as fs

actor -> kvs: Open KVS

kvs -> fs: Read defaults file

alt file-exists
fs --> kvs: Defaults file content (JSON)
else file-based-error
fs --> kvs: File-Error
kvs -> actor: File-Error
end

kvs -> fs: Read defaults file hash

alt file-exists
fs --> kvs: Defaults file hash
else file-based-error
fs --> kvs: File-Error
kvs -> actor: File-Error
end

kvs -> kvs: Generate defaults file hash

alt hash-match-success
kvs -> json_parser: Parse JSON data
else hash-match-error
kvs -> actor: Hash-Error
end

alt parsing-success
json_parser --> kvs: Parsed JSON object
else parsing-based-error
json_parser -> kvs: Parser-Error
kvs -> actor: Parser-Error
end

kvs --> actor: KVS instance

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml

title Sequence Diagram: Restore Snapshot

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Restore snapshot

alt snapshot-restore-success
kvs --> actor: Snapshot restored successfully
else snapshot-restore-error
kvs --> actor: Snapshot-Not-Available-Error
end

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@startuml

title Sequence Diagram: Write Key to KVS Instance

participant "User" as actor
participant "«component» :kvs" as kvs

actor -> kvs: Set value for key
kvs --> actor: Value set for key

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@startuml

interface IKvs {
open
flush_on_exit
reset
get_all_keys
key_exists
get_value
get_default_value
has_default_value
set_default_value
set_value
remove_key
flush
snapshot_count
snapshot_max_count
snapshot_restore
}

@enduml
Loading
Loading