Database

Database details of SOARCA

OARCA Database architecture, SOARCA makes use of MongoDB It is used to store and retrieve playbooks. Later it will also store individual steps.

Mongo

SOARCA employs separate collections in Mongo, utilizing a dedicated database object for each of them:

  • Playbook
  • Step
Interface IDatabase{
    void create(JsonData playbook)
    JsonData read(Id playbookId)
    void update(Id playbookId, JsonData playbook)
    void remove(Id playbookId)
}
Interface IPlaybookDatabase
Interface IStepDatabase

class Controller
class PlaybookDatabase

class Mongo


Controller -> IPlaybookDatabase
IStepDatabase <- Controller
IPlaybookDatabase <|.. PlaybookDatabase
IStepDatabase <|.. StepDatabase
StepDatabase -> IDatabase
IDatabase <- PlaybookDatabase

IDatabase <|.. Mongo

Getting data

Getting playbook data

participant Controller as controller
participant "Playbook Database" as playbook
database Database as db

controller -> playbook : get(id)
playbook -> db : read(playbookId)
note right
    When the create fails an error will be thrown
end note
playbook <-- db : "playbook JSON"
controller <-- playbook: "CacaoPlaybook Object"

Writing playbook data

participant Controller as controller
participant "Playbook Database" as playbook
database Database as db

controller -> playbook : set(CacaoPlaybook Object)
playbook -> db : create(playbook JSON)
note right
    When the create fails an error will be thrown
end note

Update playbook data

participant Controller as controller
participant "Playbook Database" as playbook
database Database as db

controller -> playbook : update(CacaoPlaybook Object)
playbook -> db : update(playbook id,playbook JSON)
note right
    When the create fails an error will be thrown
end note
playbook <-- db : true
controller <-- playbook: true

Delete playbook data


participant Controller as controller
participant "Playbook Database" as playbook
database Database as db

controller -> playbook : remove(playbook id)
playbook -> db : remove(playbook id)
note right
    When the create fails an error will be thrown
end note

Handling an error

participant Controller as controller
participant "Playbook Database" as playbook
database Database as db

controller -> playbook : remove(playbook id)
playbook -> db : remove(playbook id)
playbook <-- db: error 
note right
    playbook does not exists
end note
controller <-- playbook: error 

Last modified March 15, 2024: Feature/docs/18 docs update (#20) (fad4656)