├── .dockerignore ├── .env ├── .github ├── actions │ └── ec2-runners │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── action.yml │ │ └── aws.py ├── labeler.yml ├── typos_config.toml └── workflows │ ├── 0-6-cron-update-status.yaml │ ├── 0-6-cron.yaml │ ├── label-prs.yaml │ ├── lint-dockerfiles.yaml │ ├── lint-openapi.yaml │ ├── lint-splinter.yaml │ ├── lint-typos.yaml │ ├── merge.yaml │ ├── publish-docker-branch.yaml │ ├── publish-release.yaml │ ├── shell-check.yaml │ ├── splinter-dev.yaml │ ├── test-docker-build.yaml │ ├── test-psql-migrations.yaml │ └── unit-test-splinter.yaml ├── .gitignore ├── .validaterc ├── CODEOWNERS ├── Cargo.toml ├── LICENSE ├── MAINTAINERS.md ├── README.md ├── RELEASE_NOTES.md ├── VERSION ├── assets └── splinter_logos_fulllogo_gradientblack.svg ├── bin └── get_version ├── ci ├── docker-bake.hcl ├── hadolint.yaml ├── publish-crates ├── publish-docker ├── publish-splinter-crates.dockerfile ├── splinter-dev-buildx ├── splinter-dev.dockerfile └── splinter-dev.yaml ├── cli ├── Cargo.toml ├── Dockerfile-installed-jammy ├── build.rs ├── man │ ├── TEMPLATE.1.md.example │ ├── splinter-authid-create.1.md │ ├── splinter-authid-delete.1.md │ ├── splinter-authid-list.1.md │ ├── splinter-authid-show.1.md │ ├── splinter-authid-update.1.md │ ├── splinter-authid.1.md │ ├── splinter-cert-generate.1.md │ ├── splinter-cert.1.md │ ├── splinter-circuit-abandon.1.md │ ├── splinter-circuit-disband.1.md │ ├── splinter-circuit-list.1.md │ ├── splinter-circuit-proposals.1.md │ ├── splinter-circuit-propose.1.md │ ├── splinter-circuit-purge.1.md │ ├── splinter-circuit-remove-proposal.1.md │ ├── splinter-circuit-show.1.md │ ├── splinter-circuit-template-arguments.1.md │ ├── splinter-circuit-template-list.1.md │ ├── splinter-circuit-template-show.1.md │ ├── splinter-circuit-template.1.md │ ├── splinter-circuit-vote.1.md │ ├── splinter-circuit.1.md │ ├── splinter-command-get-state.1.md │ ├── splinter-command-set-state.1.md │ ├── splinter-command-show-state.1.md │ ├── splinter-command.1.md │ ├── splinter-database-migrate.1.md │ ├── splinter-database.1.md │ ├── splinter-health-status.1.md │ ├── splinter-health.1.md │ ├── splinter-keygen.1.md │ ├── splinter-maintenance-disable.1.md │ ├── splinter-maintenance-enable.1.md │ ├── splinter-maintenance-status.1.md │ ├── splinter-maintenance.1.md │ ├── splinter-permissions.1.md │ ├── splinter-playlist-batch.1.md │ ├── splinter-playlist-create.1.md │ ├── splinter-playlist-process.1.md │ ├── splinter-playlist-submit.1.md │ ├── splinter-playlist.1.md │ ├── splinter-registry-add.1.md │ ├── splinter-registry-build.1.md │ ├── splinter-registry.1.md │ ├── splinter-role-create.1.md │ ├── splinter-role-delete.1.md │ ├── splinter-role-list.1.md │ ├── splinter-role-show.1.md │ ├── splinter-role-update.1.md │ ├── splinter-role.1.md │ ├── splinter-state-migrate.1.md │ ├── splinter-upgrade.1.md │ ├── splinter-user-list.1.md │ ├── splinter-workload.1.md │ └── splinter.1.md ├── packaging │ ├── man │ │ └── README.md │ ├── scabbard_circuit_template.yaml │ └── ubuntu │ │ ├── completions │ │ └── splinter │ │ └── postinst └── src │ ├── action │ ├── api │ │ ├── mod.rs │ │ └── rbac │ │ │ ├── assignments.rs │ │ │ ├── mod.rs │ │ │ └── roles.rs │ ├── certs.rs │ ├── circuit │ │ ├── api.rs │ │ ├── builder.rs │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── template.rs │ ├── command.rs │ ├── database │ │ ├── mod.rs │ │ ├── postgres.rs │ │ ├── sqlite.rs │ │ ├── state │ │ │ ├── merkle │ │ │ │ ├── lmdb.rs │ │ │ │ └── mod.rs │ │ │ └── mod.rs │ │ ├── stores.rs │ │ └── upgrade │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── node_id.rs │ │ │ ├── receipt_store.rs │ │ │ ├── scabbard.rs │ │ │ └── yaml.rs │ ├── keygen.rs │ ├── maintenance.rs │ ├── mod.rs │ ├── permissions.rs │ ├── playlist.rs │ ├── rbac │ │ ├── assignments.rs │ │ ├── mod.rs │ │ └── roles.rs │ ├── registry │ │ ├── api.rs │ │ └── mod.rs │ ├── request_logger.rs │ ├── time.rs │ ├── user │ │ ├── api.rs │ │ └── mod.rs │ └── workload.rs │ ├── error.rs │ ├── main.rs │ ├── signing.rs │ ├── template.rs │ └── tests │ ├── circuit │ ├── list.rs │ ├── mod.rs │ ├── proposals.rs │ ├── propose.rs │ ├── show.rs │ └── vote.rs │ └── mod.rs ├── docker-compose-installed.yaml ├── docker ├── compose │ ├── .env │ ├── copy-debs.yaml │ └── run-lint.yaml ├── lint.dockerfile ├── metrics │ ├── README.md │ ├── docker-compose.yaml │ ├── grafana │ │ ├── dashboards │ │ │ └── splinter_metrics.json │ │ └── provisioning │ │ │ ├── dashboards │ │ │ └── dashboards.yaml │ │ │ └── datasources │ │ │ └── datasource.yaml │ ├── telegraf.dockerfile │ └── telegraf.toml └── typos.dockerfile ├── justfile ├── libsplinter ├── Cargo.toml ├── build.rs ├── examples │ └── mesh-echo-peer.rs ├── protos │ ├── admin.proto │ ├── authorization.proto │ ├── circuit.proto │ ├── component.proto │ ├── consensus.proto │ ├── network.proto │ ├── service.proto │ └── two_phase.proto ├── sample_files │ └── circuits.yaml.example └── src │ ├── admin │ ├── client │ │ ├── event │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── ws │ │ │ │ ├── actix_web_client.rs │ │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── reqwest.rs │ ├── error.rs │ ├── lifecycle │ │ ├── mod.rs │ │ ├── orchestrator.rs │ │ └── sync.rs │ ├── messages.rs │ ├── mod.rs │ ├── service │ │ ├── builder.rs │ │ ├── consensus.rs │ │ ├── error.rs │ │ ├── messages │ │ │ ├── mod.rs │ │ │ ├── v1 │ │ │ │ ├── builder.rs │ │ │ │ └── mod.rs │ │ │ └── v2 │ │ │ │ ├── builders.rs │ │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── proposal_store │ │ │ ├── admin_service_proposals.rs │ │ │ ├── admin_service_proposals_factory.rs │ │ │ ├── error.rs │ │ │ ├── factory.rs │ │ │ ├── mod.rs │ │ │ ├── proposal_iter.rs │ │ │ └── store.rs │ │ ├── shared.rs │ │ └── subscriber.rs │ ├── store │ │ ├── circuit.rs │ │ ├── circuit_node.rs │ │ ├── circuit_proposal.rs │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── add_circuit.rs │ │ │ │ ├── add_event.rs │ │ │ │ ├── add_proposal.rs │ │ │ │ ├── count_circuits.rs │ │ │ │ ├── count_proposals.rs │ │ │ │ ├── get_circuit.rs │ │ │ │ ├── get_node.rs │ │ │ │ ├── get_proposal.rs │ │ │ │ ├── get_service.rs │ │ │ │ ├── list_circuits.rs │ │ │ │ ├── list_events.rs │ │ │ │ ├── list_events_by_management_type_since.rs │ │ │ │ ├── list_events_since.rs │ │ │ │ ├── list_nodes.rs │ │ │ │ ├── list_proposals.rs │ │ │ │ ├── list_services.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_circuit.rs │ │ │ │ ├── remove_proposal.rs │ │ │ │ ├── update_circuit.rs │ │ │ │ ├── update_proposal.rs │ │ │ │ └── upgrade.rs │ │ │ └── schema.rs │ │ ├── error.rs │ │ ├── event.rs │ │ ├── mod.rs │ │ ├── proposed_circuit.rs │ │ ├── proposed_node.rs │ │ ├── proposed_service.rs │ │ ├── service.rs │ │ └── yaml │ │ │ └── mod.rs │ └── token │ │ ├── mod.rs │ │ ├── token_protobuf.rs │ │ └── token_protocol.rs │ ├── base62.rs │ ├── biome │ ├── client │ │ ├── mod.rs │ │ └── reqwest.rs │ ├── credentials │ │ ├── mod.rs │ │ ├── rest_api │ │ │ ├── actix_web_1 │ │ │ │ ├── authorize.rs │ │ │ │ ├── config.rs │ │ │ │ ├── login.rs │ │ │ │ ├── logout.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── register.rs │ │ │ │ ├── token.rs │ │ │ │ ├── user.rs │ │ │ │ └── verify.rs │ │ │ ├── mod.rs │ │ │ └── resources │ │ │ │ ├── authorize.rs │ │ │ │ ├── credentials.rs │ │ │ │ ├── key_management.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── token.rs │ │ │ │ └── user.rs │ │ └── store │ │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── add_credentials.rs │ │ │ │ ├── fetch_credential_by_id.rs │ │ │ │ ├── fetch_credential_by_username.rs │ │ │ │ ├── fetch_username.rs │ │ │ │ ├── list_usernames.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_credentials.rs │ │ │ │ └── update_credentials.rs │ │ │ └── schema.rs │ │ │ ├── error.rs │ │ │ ├── memory.rs │ │ │ └── mod.rs │ ├── key_management │ │ ├── mod.rs │ │ └── store │ │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── fetch_key.rs │ │ │ │ ├── insert_key.rs │ │ │ │ ├── list_keys.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_key.rs │ │ │ │ ├── update_key.rs │ │ │ │ └── update_keys_and_password.rs │ │ │ └── schema.rs │ │ │ ├── error.rs │ │ │ ├── memory.rs │ │ │ └── mod.rs │ ├── mod.rs │ ├── oauth │ │ ├── mod.rs │ │ └── store │ │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── add_session.rs │ │ │ │ ├── get_session.rs │ │ │ │ ├── get_user.rs │ │ │ │ ├── list_users.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_session.rs │ │ │ │ └── update_session.rs │ │ │ └── schema.rs │ │ │ ├── error.rs │ │ │ ├── memory.rs │ │ │ └── mod.rs │ ├── profile │ │ ├── mod.rs │ │ ├── rest_api │ │ │ ├── actix_web_1 │ │ │ │ ├── mod.rs │ │ │ │ ├── profile.rs │ │ │ │ ├── profiles.rs │ │ │ │ └── profiles_identity.rs │ │ │ └── mod.rs │ │ └── store │ │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── add_profile.rs │ │ │ │ ├── get_profile.rs │ │ │ │ ├── list_profiles.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_profile.rs │ │ │ │ └── update_profile.rs │ │ │ └── schema.rs │ │ │ ├── error.rs │ │ │ ├── memory.rs │ │ │ └── mod.rs │ └── refresh_tokens │ │ ├── mod.rs │ │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_token.rs │ │ │ ├── fetch_token.rs │ │ │ ├── mod.rs │ │ │ ├── remove_token.rs │ │ │ └── update_token.rs │ │ └── schema.rs │ │ ├── error.rs │ │ ├── memory.rs │ │ └── mod.rs │ ├── channel │ ├── crossbeam.rs │ ├── deferred.rs │ ├── error.rs │ ├── mock.rs │ ├── mod.rs │ └── mpsc.rs │ ├── circuit │ ├── handlers │ │ ├── admin_message.rs │ │ ├── circuit_error.rs │ │ ├── circuit_message.rs │ │ ├── direct_message.rs │ │ ├── mod.rs │ │ └── service_handlers.rs │ ├── mod.rs │ ├── routing │ │ ├── error.rs │ │ ├── memory │ │ │ ├── benchmarks.rs │ │ │ └── mod.rs │ │ └── mod.rs │ └── template │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── rules │ │ ├── create_services.rs │ │ ├── mod.rs │ │ ├── set_management_type.rs │ │ └── set_metadata.rs │ │ └── yaml_parser │ │ ├── mod.rs │ │ └── v1.rs │ ├── collections │ ├── bi_hash_map.rs │ ├── error.rs │ ├── mod.rs │ ├── ref_map.rs │ └── ttl_map.rs │ ├── consensus │ ├── error.rs │ ├── mod.rs │ └── two_phase │ │ ├── mod.rs │ │ ├── v1 │ │ ├── mod.rs │ │ └── timing.rs │ │ └── v2 │ │ ├── mod.rs │ │ └── timing.rs │ ├── error │ ├── constraint_violation.rs │ ├── internal.rs │ ├── invalid_argument.rs │ ├── invalid_state.rs │ ├── mod.rs │ └── unavailable.rs │ ├── events │ ├── error │ │ ├── mod.rs │ │ ├── parse_error.rs │ │ ├── reactor_error.rs │ │ └── web_socket_error.rs │ ├── mod.rs │ ├── reactor │ │ ├── igniter.rs │ │ ├── mod.rs │ │ ├── reactor_message.rs │ │ └── reactor_shutdown_signaler.rs │ └── ws │ │ ├── connection_status.rs │ │ ├── context.rs │ │ ├── listen.rs │ │ ├── mod.rs │ │ ├── parse_bytes.rs │ │ ├── shutdown_handle.rs │ │ ├── web_socket_client.rs │ │ ├── web_socket_client_cmd.rs │ │ └── ws_respoonse.rs │ ├── hex.rs │ ├── keys │ ├── error.rs │ ├── insecure.rs │ └── mod.rs │ ├── lib.rs │ ├── mesh │ ├── control.rs │ ├── incoming.rs │ ├── matrix.rs │ ├── mod.rs │ ├── outgoing.rs │ ├── pool.rs │ └── reactor.rs │ ├── migrations │ ├── diesel │ │ ├── mod.rs │ │ ├── postgres │ │ │ ├── migrations │ │ │ │ ├── 00000000000000_diesel_initial_setup │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2019-11-11-231339_biome_create_notifications │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2019-11-13-213120_biome_create_users │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2019-11-13-214153_biome_create_credentials │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2019-12-12-200956_biome_create-keys │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-01-10-204453_biome_add_foreign_key_constraint │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-03-12-194828_biome_create_refresh_tokens │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-07-24-133220_registry_create │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-08-18-213009_admin_service_store │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-10-21-172710_add_circuit_id_to_primary_key │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-11-02-144300_biome_create_oauth_users │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-11-30-143300_biome_enable_multi_oauth_login │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-02-160706_admin_add_display_name │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-08-121200-oauth-create-inflight-requests │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-11-172121_biome_remove-users-table │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-16-200231_biome_oauth_user_sessions_refactor │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-21-145125_admin_service_allow_null │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-22-125000_admin_service_event_store │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-22-201542_biome_oauth_timestamp_trigger │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-23-204959_admin_service_add_position │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-12-30-115400_add_roles_and_assignments │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-01-07-083000_biome_create_profiles │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-01-08-162225_admin_service_add_circuit_version │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-01-08-211600_admin_service_event_add_position │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-01-12-155512_biome_oauth_trigger_fix │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-01-14-155512_admin_service_add_circuit_status │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-02-01-150745_add_admin_role │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-02-09-042200_update-identity-enum │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-04-13-045000_rename_rbac_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-05-10-191805_admin_service_add_public_key │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-06-30-154942_node_id_store │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-10-13-172200_fix-admin-event-id │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-02-09-103052_remove_biome_notifications │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ └── 2022-02-17-183942_service_lifecycle │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ └── mod.rs │ │ └── sqlite │ │ │ ├── migrations │ │ │ ├── 2019-11-11-231339_biome_create_notifications │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2019-11-13-213120_biome_create_users │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2019-11-13-214153_biome_create_credentials │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2019-12-12-200956_biome_create-keys │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-03-12-194828_biome_create_refresh_tokens │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-07-24-133220_registry_create │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-08-18-213016_admin_service_store │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-10-21-172710_admin_add_circuit_id_to_primary_key │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-10-28-135000_biome_create_oath_users │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-11-30-143300_biome_enable_multi_oauth_login │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-02-161638_admin_add_display_name │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-08-121200-oauth-create-inflight-requests │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-11-172121_biome_remove-users-table │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-16-200231_biome_oauth_user_sessions_refactor │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-21-145125_admin_service_allow_null │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-22-125000_admin_service_event_store │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-22-201542_biome_oauth_timestamp_trigger │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-23-204959_admin_service_add_position │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2020-12-30-115400_add_roles_and_assignments │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-01-07-083000_biome_create_profiles │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-01-08-162225_admin_service_add_circuit_version │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-01-08-211600_admin_service_event_add_position │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-01-14-155512_admin_service_add_circuit_status │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-02-01-150745_add_admin_role │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-02-09-042200_update-identity-enum │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-04-13-045000_rename_rbac_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-05-10-191805_admin_service_add_public_key │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-06-30-154942_node_id_store │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-01-06-160426_update_rbac_roles_permission_foreign_key │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-02-09-103052_remove_biome_notifications │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-02-17-183942_service_lifecycle │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── 2022-03-15-012200_update_rbac_assignments_foreign_key │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── mod.rs │ └── mod.rs │ ├── network │ ├── auth │ │ ├── authorization │ │ │ ├── challenge │ │ │ │ ├── handlers.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── trust │ │ │ │ ├── handlers.rs │ │ │ │ └── mod.rs │ │ │ └── trust_v0 │ │ │ │ ├── handlers.rs │ │ │ │ └── mod.rs │ │ ├── connection_manager.rs │ │ ├── handlers │ │ │ ├── builder.rs │ │ │ ├── mod.rs │ │ │ └── v1_handlers │ │ │ │ ├── builders.rs │ │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── state_machine │ │ │ ├── challenge_v1 │ │ │ ├── accepting_action.rs │ │ │ ├── accepting_state.rs │ │ │ ├── initiating_action.rs │ │ │ ├── initiating_state.rs │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── trust_v0.rs │ │ │ └── trust_v1.rs │ ├── connection_manager │ │ ├── authorizers.rs │ │ ├── builder.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ └── notification.rs │ ├── dispatch │ │ ├── context.rs │ │ ├── loop.rs │ │ ├── mod.rs │ │ ├── peer.rs │ │ └── proto.rs │ ├── handlers.rs │ ├── mod.rs │ └── reply.rs │ ├── node_id │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── get_node_id.rs │ │ │ ├── mod.rs │ │ │ └── set_node_id.rs │ │ └── schema.rs │ │ ├── error.rs │ │ ├── file │ │ └── mod.rs │ │ └── mod.rs │ ├── oauth │ ├── builder │ │ ├── github.rs │ │ ├── mod.rs │ │ └── openid.rs │ ├── error.rs │ ├── mod.rs │ ├── profile │ │ ├── github.rs │ │ ├── mod.rs │ │ └── openid.rs │ ├── rest_api │ │ ├── actix │ │ │ ├── callback.rs │ │ │ ├── list_users.rs │ │ │ ├── login.rs │ │ │ ├── logout.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── resource_provider.rs │ │ └── resources │ │ │ ├── callback.rs │ │ │ ├── list_users.rs │ │ │ └── mod.rs │ ├── store │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── insert_request.rs │ │ │ │ ├── mod.rs │ │ │ │ └── remove_request.rs │ │ │ └── schema.rs │ │ ├── error.rs │ │ ├── memory.rs │ │ └── mod.rs │ └── subject │ │ ├── github.rs │ │ ├── mod.rs │ │ └── openid.rs │ ├── peer │ ├── builder.rs │ ├── connector.rs │ ├── error.rs │ ├── interconnect │ │ ├── error.rs │ │ ├── mod.rs │ │ └── pending.rs │ ├── mod.rs │ ├── notification.rs │ ├── peer_map.rs │ ├── peer_ref.rs │ ├── token.rs │ └── unreferenced.rs │ ├── protocol │ ├── authorization.rs │ ├── component.rs │ ├── mod.rs │ ├── network.rs │ └── service.rs │ ├── protos │ └── mod.rs │ ├── public_key.rs │ ├── rbac │ ├── mod.rs │ └── store │ │ ├── assignment │ │ ├── builder.rs │ │ ├── mod.rs │ │ └── update_builder.rs │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_assignment.rs │ │ │ ├── add_role.rs │ │ │ ├── get_assigned_roles.rs │ │ │ ├── get_assignment.rs │ │ │ ├── get_role.rs │ │ │ ├── list_assignments.rs │ │ │ ├── list_roles.rs │ │ │ ├── mod.rs │ │ │ ├── remove_assignment.rs │ │ │ ├── remove_role.rs │ │ │ ├── update_assignment.rs │ │ │ └── update_role.rs │ │ └── schema.rs │ │ ├── error.rs │ │ ├── identity.rs │ │ ├── mod.rs │ │ └── role │ │ ├── builder.rs │ │ ├── mod.rs │ │ └── update_builder.rs │ ├── registry │ ├── client │ │ ├── mod.rs │ │ └── reqwest.rs │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_node.rs │ │ │ ├── count_nodes.rs │ │ │ ├── delete_node.rs │ │ │ ├── get_node.rs │ │ │ ├── has_node.rs │ │ │ ├── list_nodes.rs │ │ │ ├── mod.rs │ │ │ └── update_node.rs │ │ └── schema.rs │ ├── error.rs │ ├── mod.rs │ ├── unified.rs │ └── yaml │ │ ├── local.rs │ │ ├── mod.rs │ │ └── remote.rs │ ├── rest_api │ ├── actix_web_1 │ │ ├── api.rs │ │ ├── auth.rs │ │ ├── builder.rs │ │ ├── error.rs │ │ ├── guard.rs │ │ ├── mod.rs │ │ ├── resource.rs │ │ └── websocket.rs │ ├── auth │ │ ├── actix │ │ │ ├── middleware.rs │ │ │ ├── mod.rs │ │ │ └── transform.rs │ │ ├── authorization │ │ │ ├── allow_keys.rs │ │ │ ├── authorization_handler_result.rs │ │ │ ├── maintenance │ │ │ │ ├── mod.rs │ │ │ │ └── routes │ │ │ │ │ ├── actix.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── resources.rs │ │ │ ├── mod.rs │ │ │ ├── permission.rs │ │ │ ├── permission_map │ │ │ │ ├── method.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── path_component.rs │ │ │ │ └── request_definition.rs │ │ │ ├── rbac │ │ │ │ ├── handler.rs │ │ │ │ ├── mod.rs │ │ │ │ └── rest_api │ │ │ │ │ ├── actix_web_1 │ │ │ │ │ ├── assignments.rs │ │ │ │ │ ├── error.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── roles.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── resources │ │ │ │ │ ├── assignments.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── roles.rs │ │ │ └── routes │ │ │ │ ├── actix.rs │ │ │ │ ├── mod.rs │ │ │ │ └── resources.rs │ │ ├── authorization_header.rs │ │ ├── authorization_result.rs │ │ ├── bearer_token.rs │ │ ├── identity │ │ │ ├── biome.rs │ │ │ ├── cylinder.rs │ │ │ ├── mod.rs │ │ │ └── oauth.rs │ │ └── mod.rs │ ├── bind_config.rs │ ├── cors.rs │ ├── errors │ │ ├── mod.rs │ │ ├── request_error.rs │ │ └── rest_api_server_error.rs │ ├── mod.rs │ ├── oauth_config.rs │ ├── paging.rs │ ├── response_models.rs │ ├── secrets │ │ ├── auto_secret_manager.rs │ │ ├── error.rs │ │ └── mod.rs │ └── sessions │ │ ├── claims.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ └── token_issuer.rs │ ├── runtime │ ├── mod.rs │ └── service │ │ ├── dispatch │ │ ├── mod.rs │ │ ├── service_dispatcher.rs │ │ ├── task.rs │ │ ├── task_job_executor.rs │ │ ├── task_single_threaded.rs │ │ ├── type_resolver.rs │ │ └── type_resolver_routing_table.rs │ │ ├── instance │ │ ├── mod.rs │ │ ├── orchestrator │ │ │ ├── builder.rs │ │ │ ├── endpoint_provider.rs │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── runnable.rs │ │ └── processor │ │ │ ├── builder.rs │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ └── sender.rs │ │ ├── lifecycle_executor │ │ ├── commands │ │ │ ├── generator.rs │ │ │ └── mod.rs │ │ ├── executor │ │ │ ├── alarm │ │ │ │ ├── channel.rs │ │ │ │ └── mod.rs │ │ │ ├── message.rs │ │ │ ├── mod.rs │ │ │ └── thread.rs │ │ ├── mod.rs │ │ └── store │ │ │ ├── diesel │ │ │ ├── factory.rs │ │ │ ├── mod.rs │ │ │ ├── models.rs │ │ │ ├── operations │ │ │ │ ├── add_service.rs │ │ │ │ ├── get_service.rs │ │ │ │ ├── list_service.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── remove_service.rs │ │ │ │ └── update_service.rs │ │ │ └── schema.rs │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── service.rs │ │ ├── mod.rs │ │ ├── network_sender_factory.rs │ │ └── timer │ │ ├── alarm │ │ ├── channel.rs │ │ └── mod.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ └── thread.rs │ ├── service │ ├── arguments_converter.rs │ ├── id │ │ ├── circuit.rs │ │ ├── mod.rs │ │ ├── qualified.rs │ │ └── service.rs │ ├── instance │ │ ├── error.rs │ │ ├── factory │ │ │ ├── endpoint.rs │ │ │ ├── mod.rs │ │ │ └── service.rs │ │ ├── message_context.rs │ │ ├── mod.rs │ │ ├── network_registry.rs │ │ ├── network_sender.rs │ │ ├── orchestrator │ │ │ ├── factory.rs │ │ │ ├── mod.rs │ │ │ └── service.rs │ │ ├── service_instance.rs │ │ └── validation.rs │ ├── lifecycle.rs │ ├── message_converter.rs │ ├── message_handler.rs │ ├── message_handler_factory.rs │ ├── message_sender.rs │ ├── message_sender_factory.rs │ ├── mod.rs │ ├── rest_api.rs │ ├── routable.rs │ ├── service_type.rs │ ├── timer_alarm.rs │ ├── timer_alarm_factory.rs │ ├── timer_filter.rs │ ├── timer_handler.rs │ └── timer_handler_factory.rs │ ├── store │ ├── command │ │ ├── executor │ │ │ ├── diesel │ │ │ │ ├── mod.rs │ │ │ │ ├── postgres.rs │ │ │ │ └── sqlite.rs │ │ │ └── mod.rs │ │ └── mod.rs │ ├── memory.rs │ ├── mod.rs │ ├── pool.rs │ ├── postgres.rs │ └── sqlite.rs │ ├── tap │ ├── influx.rs │ └── mod.rs │ ├── threading │ ├── error.rs │ ├── lifecycle.rs │ ├── mod.rs │ ├── pacemaker.rs │ └── pool.rs │ └── transport │ ├── error.rs │ ├── inproc.rs │ ├── matrix.rs │ ├── mod.rs │ ├── multi.rs │ ├── raw.rs │ ├── socket │ ├── frame.rs │ ├── mod.rs │ ├── tcp.rs │ └── tls.rs │ ├── tls.rs │ └── ws │ ├── connection.rs │ ├── listener.rs │ ├── mod.rs │ └── transport.rs ├── rest_api ├── actix_web_1 │ ├── Cargo.toml │ └── src │ │ ├── admin │ │ ├── circuits.rs │ │ ├── circuits_circuit_id.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── proposals.rs │ │ ├── proposals_circuit_id.rs │ │ ├── resources │ │ │ ├── mod.rs │ │ │ ├── v1 │ │ │ │ ├── circuits.rs │ │ │ │ ├── circuits_circuit_id.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── proposals.rs │ │ │ │ └── proposals_circuit_id.rs │ │ │ └── v2 │ │ │ │ ├── circuits.rs │ │ │ │ ├── circuits_circuit_id.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── proposals.rs │ │ │ │ └── proposals_circuit_id.rs │ │ ├── submit.rs │ │ └── ws_register_type.rs │ │ ├── biome │ │ ├── key_management │ │ │ ├── endpoints.rs │ │ │ ├── mod.rs │ │ │ └── resources.rs │ │ └── mod.rs │ │ ├── hex.rs │ │ ├── lib.rs │ │ ├── open_api │ │ ├── mod.rs │ │ └── resource_provider.rs │ │ ├── registry │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── nodes.rs │ │ ├── nodes_identity.rs │ │ └── resources │ │ │ ├── mod.rs │ │ │ ├── nodes.rs │ │ │ └── nodes_identity.rs │ │ ├── scabbard │ │ ├── batch_statuses.rs │ │ ├── batches.rs │ │ ├── mod.rs │ │ ├── state.rs │ │ ├── state_address.rs │ │ ├── state_root.rs │ │ └── ws_subscribe.rs │ │ ├── service │ │ ├── builder.rs │ │ └── mod.rs │ │ └── status │ │ ├── mod.rs │ │ └── resource_provider.rs ├── actix_web_4 │ ├── Cargo.toml │ └── src │ │ └── lib.rs └── common │ ├── Cargo.toml │ └── src │ ├── error.rs │ ├── lib.rs │ ├── paging │ ├── mod.rs │ └── v1 │ │ ├── builder.rs │ │ └── mod.rs │ ├── scabbard │ ├── batch_statuses.rs │ ├── batches.rs │ ├── mod.rs │ └── state.rs │ └── status │ └── mod.rs ├── services ├── echo │ └── libecho │ │ ├── Cargo.toml │ │ └── src │ │ ├── lib.rs │ │ ├── migrations │ │ ├── diesel │ │ │ ├── mod.rs │ │ │ ├── postgres │ │ │ │ ├── migrations │ │ │ │ │ └── 2022-03-03-141100_create_echo_tables │ │ │ │ │ │ ├── down.sql │ │ │ │ │ │ └── up.sql │ │ │ │ └── mod.rs │ │ │ └── sqlite │ │ │ │ ├── migrations │ │ │ │ └── 2022-01-27-205126_create_echo_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ └── mod.rs │ │ └── mod.rs │ │ ├── service │ │ ├── arguments.rs │ │ ├── arguments_converter.rs │ │ ├── lifecycle.rs │ │ ├── message.rs │ │ ├── message_converter.rs │ │ ├── message_handler.rs │ │ ├── message_handler_factory.rs │ │ ├── mod.rs │ │ ├── request.rs │ │ ├── status.rs │ │ ├── timer_filter.rs │ │ ├── timer_handler.rs │ │ └── timer_handler_factory.rs │ │ └── store │ │ ├── command │ │ ├── finalize_service.rs │ │ ├── mod.rs │ │ ├── prepare_service.rs │ │ ├── purge_service.rs │ │ └── retire_service.rs │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_service.rs │ │ │ ├── get_last_sent.rs │ │ │ ├── get_service_arguments.rs │ │ │ ├── get_service_status.rs │ │ │ ├── insert_request.rs │ │ │ ├── insert_request_error.rs │ │ │ ├── list_ready_services.rs │ │ │ ├── list_requests.rs │ │ │ ├── mod.rs │ │ │ ├── remove_service.rs │ │ │ ├── update_request_ack.rs │ │ │ ├── update_request_sent.rs │ │ │ └── update_service_status.rs │ │ ├── pool.rs │ │ └── schema.rs │ │ ├── factory │ │ ├── mod.rs │ │ ├── postgres.rs │ │ └── sqlite.rs │ │ └── mod.rs └── scabbard │ ├── cli │ ├── Cargo.toml │ ├── Dockerfile-installed-jammy │ ├── build.rs │ ├── man │ │ ├── scabbard-contract-list.1.md │ │ ├── scabbard-contract-show.1.md │ │ ├── scabbard-contract-upload.1.md │ │ ├── scabbard-contract.1.md │ │ ├── scabbard-cr-create.1.md │ │ ├── scabbard-cr-delete.1.md │ │ ├── scabbard-cr-update.1.md │ │ ├── scabbard-cr.1.md │ │ ├── scabbard-exec.1.md │ │ ├── scabbard-ns-create.1.md │ │ ├── scabbard-ns-delete.1.md │ │ ├── scabbard-ns-update.1.md │ │ ├── scabbard-ns.1.md │ │ ├── scabbard-perm.1.md │ │ └── scabbard.1.md │ ├── packaging │ │ ├── man │ │ │ └── README.md │ │ └── ubuntu │ │ │ └── postinst │ └── src │ │ ├── error.rs │ │ ├── main.rs │ │ └── signing.rs │ └── libscabbard │ ├── Cargo.toml │ ├── build.rs │ ├── protos │ ├── scabbard.proto │ └── scabbard_v3.proto │ └── src │ ├── client │ ├── error.rs │ ├── mod.rs │ └── reqwest │ │ ├── builder.rs │ │ └── mod.rs │ ├── hex.rs │ ├── lib.rs │ ├── migrations │ ├── diesel │ │ ├── mod.rs │ │ ├── postgres │ │ │ ├── migrations │ │ │ │ ├── 2021-09-02-1355000-create-commit-log-tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-10-05-1414000-rename-commit-log-table │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-03-29-160500-create-scabbard-store-tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-04-05-153027_scabbard_commit_history │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-04-21-160128_add_consensus │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-04-21-174800_scabbard_consensus_event_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-05-05-142800-create-scabbard-alarm-table │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-05-08-091429-remove-consensus-duplicate-service-id │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-08-133219-remove-action-and-event-position │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-08-164819-update-consensus-service-id │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-16-131600-consensus-add-decision-ack │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-16-154357_supervisor │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-25-213027_fix_v3_postgres │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-06-28-162859_update-consensus-action │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-01-135648_fix_remove_service │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-05-014045-event-table-updates │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-05-091217-consensus-table-fixes │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-08-133500-add-consensus-2pc-views │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-25-085317-add-update-context-action-id │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-25-151237-add-consensus-2pc-event-context-view │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ └── 2022-07-26-141800-fix-consensus-2pc-uca-participant-key │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ └── mod.rs │ │ └── sqlite │ │ │ ├── migrations │ │ │ ├── 2021-09-02-1355000-create-commit-log-tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-10-05-1414000-rename-commit-log-table │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-03-29-160500-create-scabbard-store-tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-04-05-153027_scabbard_commit_history │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-04-21-160128_add_consensus │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-04-21-174800_scabbard_consensus_event_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-05-05-142800-create-scabbard-alarm-table │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-08-091429-remove-consensus-duplicate-service-id │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-08-133219-remove-action-and-event-position │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-08-164819-update-consensus-service-id │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-16-131600-consensus-add-decision-ack │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-16-154357_supervisor │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-06-28-162859_update-consensus-action │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-07-01-135648_fix_remove_service │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-07-05-014045-event-table-updates │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-07-05-091217-consensus-table-fixes │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-07-08-133500-add-consensus-2pc-views │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-07-25-085317-add-update-context-action-id │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── 2022-07-25-151237-add-consensus-2pc-event-context-view │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── mod.rs │ └── mod.rs │ ├── protocol │ ├── mod.rs │ └── v3 │ │ ├── message.rs │ │ ├── mod.rs │ │ └── two_phase_commit.rs │ ├── protos │ └── mod.rs │ ├── service │ ├── consensus.rs │ ├── error.rs │ ├── factory │ │ ├── endpoint_provider.rs │ │ └── mod.rs │ ├── mod.rs │ ├── rest_api │ │ └── mod.rs │ ├── shared.rs │ ├── state │ │ ├── merkle_state.rs │ │ └── mod.rs │ └── v3 │ │ ├── arguments.rs │ │ ├── arguments_converter.rs │ │ ├── consensus │ │ ├── consensus_action_runner │ │ │ ├── commands │ │ │ │ ├── actions.rs │ │ │ │ ├── context.rs │ │ │ │ └── mod.rs │ │ │ ├── context_updater │ │ │ │ ├── mod.rs │ │ │ │ └── store.rs │ │ │ ├── mod.rs │ │ │ └── notify_observer │ │ │ │ └── mod.rs │ │ ├── consensus_runner │ │ │ ├── builder.rs │ │ │ ├── consensus_store_command_factory.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── process.rs │ │ └── value.rs │ │ ├── lifecycle.rs │ │ ├── message_converter.rs │ │ ├── message_handler.rs │ │ ├── message_handler_factory.rs │ │ ├── mod.rs │ │ ├── publisher │ │ ├── artifact.rs │ │ ├── mod.rs │ │ └── publisher_context.rs │ │ ├── supervisor │ │ ├── builder.rs │ │ ├── commands.rs │ │ ├── mod.rs │ │ ├── notifier.rs │ │ └── notify_observer.rs │ │ ├── timer_filter.rs │ │ ├── timer_handler.rs │ │ └── timer_handler_factory.rs │ └── store │ ├── command │ ├── finalize_service.rs │ ├── mod.rs │ ├── prepare_service.rs │ ├── purge_service.rs │ └── retire_service.rs │ ├── commit_hash │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── get_current_commit_hash.rs │ │ │ ├── mod.rs │ │ │ └── set_current_commit_hash.rs │ │ └── schema.rs │ ├── error.rs │ ├── mod.rs │ └── transact │ │ ├── factory.rs │ │ └── mod.rs │ ├── diesel_postgres_test.rs │ ├── mod.rs │ ├── pool.rs │ └── scabbard_store │ ├── action.rs │ ├── alarm.rs │ ├── boxed.rs │ ├── commit.rs │ ├── context.rs │ ├── diesel │ ├── mod.rs │ ├── models │ │ ├── alarm.rs │ │ ├── commit_entry.rs │ │ ├── consensus.rs │ │ ├── mod.rs │ │ ├── service.rs │ │ └── supervisor.rs │ ├── operations │ │ ├── add_commit_entry.rs │ │ ├── add_consensus_action.rs │ │ ├── add_consensus_context.rs │ │ ├── add_consensus_event.rs │ │ ├── add_service.rs │ │ ├── add_supervisor_notification.rs │ │ ├── get_alarm.rs │ │ ├── get_current_consensus_context.rs │ │ ├── get_last_commit_entry.rs │ │ ├── get_service.rs │ │ ├── list_consensus_actions.rs │ │ ├── list_consensus_events.rs │ │ ├── list_ready_services.rs │ │ ├── list_supervisor_notifications.rs │ │ ├── mod.rs │ │ ├── remove_service.rs │ │ ├── set_alarm.rs │ │ ├── unset_alarm.rs │ │ ├── update_commit_entry.rs │ │ ├── update_consensus_action.rs │ │ ├── update_consensus_context.rs │ │ ├── update_consensus_event.rs │ │ ├── update_service.rs │ │ └── update_supervisor_notification.rs │ └── schema.rs │ ├── error.rs │ ├── event.rs │ ├── factory │ ├── mod.rs │ ├── postgres.rs │ └── sqlite.rs │ ├── identified.rs │ ├── mod.rs │ ├── service.rs │ ├── supervisor.rs │ └── two_phase_commit │ ├── action.rs │ ├── context.rs │ ├── event.rs │ ├── message.rs │ ├── mod.rs │ └── state.rs ├── splinterd ├── Cargo.toml ├── Dockerfile-installed-jammy ├── api │ ├── openapi.dockerfile │ └── static │ │ └── openapi.yaml ├── build.rs ├── man │ └── splinterd.1.md ├── packaging │ ├── man │ │ └── README.md │ ├── registry.yaml.example │ ├── splinterd.toml.example │ ├── systemd │ │ ├── splinterd │ │ └── splinterd.service │ └── ubuntu │ │ └── postinst ├── src │ ├── config │ │ ├── builder.rs │ │ ├── clap.rs │ │ ├── default.rs │ │ ├── env.rs │ │ ├── error.rs │ │ ├── logging.rs │ │ ├── mod.rs │ │ ├── partial.rs │ │ └── toml.rs │ ├── daemon │ │ ├── builder.rs │ │ ├── error.rs │ │ ├── lifecycle.rs │ │ ├── mod.rs │ │ ├── registry.rs │ │ ├── store.rs │ │ └── timer.rs │ ├── error.rs │ ├── lib.rs │ ├── logging.rs │ ├── main.rs │ ├── node │ │ ├── builder │ │ │ ├── admin.rs │ │ │ ├── biome.rs │ │ │ ├── mod.rs │ │ │ ├── network.rs │ │ │ └── scabbard.rs │ │ ├── mod.rs │ │ ├── runnable │ │ │ ├── admin.rs │ │ │ ├── biome.rs │ │ │ ├── mod.rs │ │ │ └── network.rs │ │ └── running │ │ │ ├── admin.rs │ │ │ ├── biome.rs │ │ │ ├── mod.rs │ │ │ └── network.rs │ ├── node_id.rs │ └── transport.rs └── tests │ ├── admin │ ├── biome.rs │ ├── circuit_abandon.rs │ ├── circuit_commit.rs │ ├── circuit_create.rs │ ├── circuit_disband.rs │ ├── circuit_list.rs │ ├── circuit_purge.rs │ ├── mod.rs │ ├── node_lifecycle.rs │ ├── payload.rs │ ├── registry.rs │ └── rest_api.rs │ ├── admin_service.rs │ └── framework │ ├── circuit_builder │ ├── builder.rs │ ├── error.rs │ ├── mod.rs │ └── veil │ │ ├── mod.rs │ │ └── scabbard.rs │ ├── mod.rs │ ├── network.rs │ └── shutdown.rs └── tests ├── .env ├── Dockerfile ├── migrations ├── .env ├── bin │ ├── check_splinterd │ ├── check_states │ ├── prepare_circuit │ ├── test_psql_migrations │ └── workload ├── docker-compose.yaml ├── docker │ └── workload.dockerfile └── registry.yaml └── test-splinter.yaml /.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /.github/actions/ec2-runners/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM ubuntu:jammy 16 | 17 | RUN apt-get update && apt-get install -yq --no-install-recommends \ 18 | python3 \ 19 | python3-pip \ 20 | && pip3 install \ 21 | botocore \ 22 | boto3 \ 23 | requests 24 | 25 | COPY aws.py /aws.py 26 | 27 | ENTRYPOINT ["/aws.py"] 28 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | backport-triage: 2 | - '**' 3 | 4 | main: 5 | - '**' 6 | -------------------------------------------------------------------------------- /.github/typos_config.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [default.extend-words] 16 | OTU = "OTU" 17 | # workaround for false positive in splinterd/api/static/openapi.yaml 18 | # https://github.com/crate-ci/typos/issues/484 19 | 20 | [default.extend-identifiers] 21 | ERRORs = "ERRORs" 22 | # workaround for false positive in tests/migrations/bin/test_psql_migrations 23 | # https://github.com/crate-ci/typos/issues/399 24 | -------------------------------------------------------------------------------- /.github/workflows/0-6-cron-update-status.yaml: -------------------------------------------------------------------------------- 1 | name: 0-6 Update Branch Status 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["0-6 Cron"] 6 | types: 7 | - completed 8 | 9 | jobs: 10 | update_status: 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | ref: 0-6 17 | 18 | - name: get SHA 19 | run: echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV 20 | 21 | - name: Update commit status 22 | run: | 23 | env 24 | curl \ 25 | -X POST \ 26 | -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ 27 | -H "Accept: application/vnd.github.v3+json" \ 28 | https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.SHA }} \ 29 | -d '{"state": "${{ github.event.workflow_run.conclusion }}", "context": "Cron"}' 30 | -------------------------------------------------------------------------------- /.github/workflows/label-prs.yaml: -------------------------------------------------------------------------------- 1 | name: "Label PRs" 2 | on: 3 | pull_request_target: 4 | types: [ opened ] 5 | 6 | jobs: 7 | label_pr: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/labeler@v3 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 13 | -------------------------------------------------------------------------------- /.github/workflows/lint-dockerfiles.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Splinter Dockerfiles 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | lint_dockerfiles: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run hadolint on Splinter Dockerfiles 26 | run: just ci-lint-dockerfiles 27 | -------------------------------------------------------------------------------- /.github/workflows/lint-openapi.yaml: -------------------------------------------------------------------------------- 1 | name: Lint OpenAPI spec 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_openapi: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Lint OpenAPI files 23 | run: just ci-lint-openapi 24 | -------------------------------------------------------------------------------- /.github/workflows/lint-splinter.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Splinter 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | lint_splinter: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run Lint/Clippy on Splinter 26 | run: just ci-lint-splinter 27 | -------------------------------------------------------------------------------- /.github/workflows/lint-typos.yaml: -------------------------------------------------------------------------------- 1 | name: Check For Typos 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_typos: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Check for typos 23 | run: just ci-lint-typos 24 | -------------------------------------------------------------------------------- /.github/workflows/shell-check.yaml: -------------------------------------------------------------------------------- 1 | name: Shellcheck Splinter CLI 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | shellcheck_splinter: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run Shellcheck on Splinter 26 | run: just ci-shellcheck 27 | -------------------------------------------------------------------------------- /.github/workflows/test-docker-build.yaml: -------------------------------------------------------------------------------- 1 | name: Build Docker 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build_docker: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Display envvars 22 | run: env 23 | 24 | - name: Install Just 25 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 26 | 27 | - name: Test Docker Build 28 | run: just docker-build 29 | 30 | - name: Copy Artifacts 31 | run: docker-compose -f docker/compose/copy-debs.yaml up 32 | 33 | - name: Archive Artifacts 34 | run: zip -r splinter-pr${{ github.event.number }}.zip build/* 35 | 36 | - uses: actions/upload-artifact@v2 37 | with: 38 | name: splinter-pr${{ github.event.number }} 39 | path: splinter-pr*.zip 40 | -------------------------------------------------------------------------------- /.github/workflows/test-psql-migrations.yaml: -------------------------------------------------------------------------------- 1 | name: Test PSQL Migrations 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | test_psql_migrations: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Test PSQL Migrations 26 | run: just ci-test-migrations 27 | 28 | - uses: actions/upload-artifact@v3 29 | if: failure() 30 | with: 31 | name: pr-${{ github.event.number }}-test-psql-migrations.log 32 | path: ./tests/migrations/test-psql-migrations.log 33 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @agunde406 @ameliabradley @Caleb-Hill @davececchi @dnewh @dplumb94 @isabeltomb @jsmitchell @peterschwarz @ltseeley @rbuysse @RyanLassigBanks @shannynalayna @vaporos 2 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintainers 2 | 3 | ### Active Maintainers 4 | | Name | GitHub | 5 | | --- | --- | 6 | | Amelia Bradley | ameliabradley | 7 | | Andi Gunderson | agunde406 | 8 | | Caleb Hill | Caleb-Hill | 9 | | Darian Plumb | dplumb94 | 10 | | Dave Cecchi | davececchi | 11 | | Davey Newhall | dnewh | 12 | | Isabel Tomb | isabeltomb | 13 | | James Mitchell | jsmitchell | 14 | | Logan Seeley | ltseeley | 15 | | Peter Schwarz | peterschwarz | 16 | | Ryan Banks | RyanLassigBanks | 17 | | Ryan Beck-Buysse | rbuysse | 18 | | Shannyn Telander | shannynalayna | 19 | | Shawn Amundson | vaporos | 20 | 21 | 22 | # Retired Maintainers 23 | | Name | GitHub | 24 | | --- | --- | 25 | | Anne Chenette | chenette | 26 | | Eloá Franca Verona | eloaverona | 27 | | Zac Skalko | zapplebee | 28 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.7.1 2 | -------------------------------------------------------------------------------- /ci/hadolint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ignored: 16 | - DL3008 17 | - DL3018 18 | -------------------------------------------------------------------------------- /ci/publish-crates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018-2022 Cargill Incorporated 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | top_dir=$(cd $(dirname $(dirname $0)) && pwd) 17 | 18 | export VERSION=AUTO_STRICT 19 | export REPO_VERSION=$($top_dir/bin/get_version) 20 | 21 | docker build -f ci/publish-splinter-crates.dockerfile -t publish-splinter-crates ci/ 22 | docker run \ 23 | --rm \ 24 | -v $(pwd):/project/splinter \ 25 | -e REPO_VERSION=$REPO_VERSION \ 26 | -e CARGO_CRED=$CARGO_TOKEN \ 27 | publish-splinter-crates 28 | -------------------------------------------------------------------------------- /ci/splinter-dev.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ------------------------------------------------------------------------------ 15 | 16 | version: '3.7' 17 | 18 | services: 19 | splinter-dev: 20 | image: splintercommunity/splinter-dev:v13 21 | build: 22 | context: .. 23 | dockerfile: ci/splinter-dev.dockerfile 24 | -------------------------------------------------------------------------------- /cli/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for the `splinter` CLI will 2 | be located. 3 | -------------------------------------------------------------------------------- /cli/packaging/scabbard_circuit_template.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | args: 3 | - name: ADMIN_KEYS 4 | required: false 5 | default: $(SIGNER_PUB_KEY) 6 | description: >- 7 | Public keys used to verify transactions in the scabbard service 8 | - name: NODES 9 | required: true 10 | description: "List of node IDs" 11 | - name: SIGNER_PUB_KEY 12 | required: false 13 | description: "Public key of the signer" 14 | rules: 15 | create-services: 16 | service-type: 'scabbard' 17 | service-args: 18 | - key: 'admin_keys' 19 | value: [$(ADMIN_KEYS)] 20 | - key: 'peer_services' 21 | value: '$(ALL_OTHER_SERVICES)' 22 | - key: 'version' 23 | value: '2' 24 | first-service: 'a000' 25 | -------------------------------------------------------------------------------- /cli/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module provides integration tests for the splinter CLI. 16 | 17 | mod circuit; 18 | -------------------------------------------------------------------------------- /docker/compose/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /docker/compose/run-lint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: "3.7" 16 | 17 | services: 18 | 19 | lint-splinter: 20 | build: 21 | context: ../ 22 | dockerfile: ./lint.dockerfile 23 | args: 24 | - http_proxy 25 | - https_proxy 26 | - no_proxy 27 | image: lint-splinter:${ISOLATION_ID} 28 | volumes: 29 | - ../../:/project/splinter 30 | command: just lint 31 | -------------------------------------------------------------------------------- /docker/lint.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM splintercommunity/splinter-dev:v13 16 | 17 | ENV PATH=$PATH:/project/splinter/bin 18 | 19 | RUN rustup component add rustfmt clippy 20 | 21 | WORKDIR /project/splinter 22 | -------------------------------------------------------------------------------- /docker/metrics/grafana/provisioning/dashboards/dashboards.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: 1 16 | 17 | providers: 18 | - name: 'splinter-metrics' 19 | orgId: 1 20 | folder: '' 21 | type: file 22 | disableDeletion: false 23 | updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards 24 | options: 25 | path: /var/lib/grafana/dashboards 26 | -------------------------------------------------------------------------------- /docker/metrics/grafana/provisioning/datasources/datasource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: 1 16 | 17 | datasources: 18 | - name: splinter_metrics 19 | access: proxy 20 | database: metrics 21 | editable: true 22 | isDefault: true 23 | orgId: 1 24 | password: foobar 25 | type: influxdb 26 | url: http://splinter-influx:8086 27 | user: admin 28 | -------------------------------------------------------------------------------- /docker/metrics/telegraf.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM ubuntu:bionic 16 | 17 | RUN apt-get update \ 18 | && apt-get install -qy --no-install-recommends \ 19 | ca-certificates \ 20 | tar \ 21 | wget \ 22 | && wget -q https://dl.influxdata.com/telegraf/releases/telegraf_1.17.2-1_amd64.deb \ 23 | && dpkg -i telegraf_1.17.2-1_amd64.deb \ 24 | && rm -r /var/lib/apt/lists/* 25 | 26 | WORKDIR /project 27 | -------------------------------------------------------------------------------- /docker/typos.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:3 16 | 17 | RUN apk add --no-cache curl 18 | 19 | WORKDIR /tmp 20 | 21 | RUN curl -O -L https://github.com/crate-ci/typos/releases/download/v1.10.2/typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz \ 22 | && tar xzvf typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz 23 | 24 | ENV PATH=$PATH:/tmp 25 | 26 | WORKDIR /project 27 | -------------------------------------------------------------------------------- /libsplinter/src/admin/client/event/ws/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | //! Websocket-backed implementations of the AdminServiceEventClient. 15 | 16 | #[cfg(feature = "admin-service-event-client-actix-web-client")] 17 | pub mod actix_web_client; 18 | -------------------------------------------------------------------------------- /libsplinter/src/admin/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub use super::service::error::MarshallingError; 16 | -------------------------------------------------------------------------------- /libsplinter/src/admin/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Splinter administrative components. 16 | 17 | #[cfg(feature = "admin-service-client")] 18 | pub mod client; 19 | pub mod error; 20 | pub mod lifecycle; 21 | pub mod messages; 22 | pub mod service; 23 | pub mod store; 24 | mod token; 25 | 26 | pub const CIRCUIT_PROTOCOL_VERSION: i32 = 2; 27 | -------------------------------------------------------------------------------- /libsplinter/src/admin/service/proposal_store/factory.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::store::ProposalStore; 16 | 17 | pub trait ProposalStoreFactory: Clone + Send + Sync { 18 | fn new_proposal_store<'a>(&'a self) -> Box; 19 | } 20 | -------------------------------------------------------------------------------- /libsplinter/src/admin/service/proposal_store/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod admin_service_proposals; 16 | mod admin_service_proposals_factory; 17 | pub mod error; 18 | mod factory; 19 | pub mod proposal_iter; 20 | pub mod store; 21 | 22 | pub use admin_service_proposals::AdminServiceProposals; 23 | pub use admin_service_proposals_factory::AdminServiceProposalsFactory; 24 | pub use factory::ProposalStoreFactory; 25 | pub use store::ProposalStore; 26 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines a basic API to register and authenticate a User using a username and a password. 16 | //! Not recommended for use in production. 17 | 18 | #[cfg(feature = "rest-api-actix-web-1")] 19 | pub mod rest_api; 20 | pub mod store; 21 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/authorize.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines results from user authorization. 16 | 17 | use crate::rest_api::sessions::Claims; 18 | 19 | pub(crate) enum AuthorizationResult { 20 | Authorized(Claims), 21 | Unauthorized, 22 | Failed, 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/credentials.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines credentials used to register and authenticate users. 16 | 17 | #[derive(Deserialize)] 18 | pub(crate) struct UsernamePassword { 19 | pub username: String, 20 | pub hashed_password: String, 21 | } 22 | 23 | #[derive(Serialize)] 24 | pub(crate) struct NewUser<'a> { 25 | pub user_id: &'a str, 26 | pub username: &'a str, 27 | } 28 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines credentials used to register and authenticate users. 16 | 17 | pub(super) mod authorize; 18 | pub(super) mod credentials; 19 | #[cfg(feature = "biome-key-management")] 20 | pub(super) mod key_management; 21 | pub(super) mod token; 22 | pub(super) mod user; 23 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/token.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Deserialize)] 16 | pub struct RefreshToken { 17 | pub token: String, 18 | } 19 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/user.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "biome-key-management")] 16 | use super::key_management::NewKey; 17 | 18 | #[derive(Deserialize)] 19 | pub(crate) struct ModifyUser { 20 | pub username: String, 21 | pub hashed_password: String, 22 | pub new_password: Option, 23 | #[cfg(feature = "biome-key-management")] 24 | pub new_key_pairs: Vec, 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | user_credentials { 17 | id -> Int8, 18 | user_id -> Text, 19 | username -> Text, 20 | password -> Text, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libsplinter/src/biome/key_management/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::keys; 16 | 17 | #[derive(Insertable, Queryable, Identifiable, PartialEq, Eq, Debug)] 18 | #[table_name = "keys"] 19 | #[primary_key(public_key, user_id)] 20 | pub struct KeyModel { 21 | pub public_key: String, 22 | pub encrypted_private_key: String, 23 | pub user_id: String, 24 | pub display_name: String, 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/biome/key_management/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | keys (public_key, user_id) { 17 | public_key -> Text, 18 | encrypted_private_key -> Text, 19 | user_id -> Text, 20 | display_name -> Text, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libsplinter/src/biome/oauth/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Biome functionality to support OAuth authentication methods. 16 | 17 | pub mod store; 18 | -------------------------------------------------------------------------------- /libsplinter/src/biome/oauth/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | oauth_users (subject) { 17 | subject -> Text, 18 | user_id -> Text, 19 | } 20 | } 21 | 22 | table! { 23 | oauth_user_sessions (splinter_access_token) { 24 | splinter_access_token -> Text, 25 | subject -> Text, 26 | oauth_access_token -> Text, 27 | oauth_refresh_token -> Nullable, 28 | last_authenticated -> BigInt, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libsplinter/src/biome/profile/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Biome functionality to support user profiles. 16 | 17 | #[cfg(feature = "rest-api-actix-web-1")] 18 | pub mod rest_api; 19 | pub mod store; 20 | -------------------------------------------------------------------------------- /libsplinter/src/biome/profile/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | user_profile (user_id) { 17 | user_id -> Text, 18 | subject -> Text, 19 | name -> Nullable, 20 | given_name -> Nullable, 21 | family_name -> Nullable, 22 | email -> Nullable, 23 | picture -> Nullable, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/biome/refresh_tokens/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines a basic representation of a user and provides an API to manage credentials. 16 | 17 | pub mod store; 18 | -------------------------------------------------------------------------------- /libsplinter/src/biome/refresh_tokens/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | refresh_tokens (id) { 17 | id -> Int8, 18 | user_id -> Text, 19 | token -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/circuit/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Circuit routing and message handling. 16 | 17 | pub mod handlers; 18 | pub mod routing; 19 | #[cfg(feature = "circuit-template")] 20 | pub mod template; 21 | -------------------------------------------------------------------------------- /libsplinter/src/collections/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Debug, PartialEq, Eq)] 16 | pub struct RefMapRemoveError(pub String); 17 | 18 | impl std::error::Error for RefMapRemoveError {} 19 | 20 | impl std::fmt::Display for RefMapRemoveError { 21 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 22 | f.write_str(&self.0) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libsplinter/src/collections/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Collections used within this crate. 16 | 17 | mod bi_hash_map; 18 | mod error; 19 | mod ref_map; 20 | #[cfg(feature = "oauth")] 21 | mod ttl_map; 22 | 23 | pub(crate) use bi_hash_map::BiHashMap; 24 | pub(crate) use ref_map::RefMap; 25 | #[cfg(feature = "oauth")] 26 | pub(crate) use ttl_map::TtlMap; 27 | -------------------------------------------------------------------------------- /libsplinter/src/consensus/two_phase/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! A simple n-party, two-phase commit (2PC) consensus algorithm implemented as a `ConsensusEngine` 16 | 17 | pub mod v1; 18 | pub mod v2; 19 | -------------------------------------------------------------------------------- /libsplinter/src/events/error/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod parse_error; 16 | mod reactor_error; 17 | mod web_socket_error; 18 | 19 | pub use parse_error::ParseError; 20 | pub use reactor_error::ReactorError; 21 | pub use web_socket_error::WebSocketError; 22 | -------------------------------------------------------------------------------- /libsplinter/src/events/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Low-level websocket-based event client. 16 | 17 | mod error; 18 | mod reactor; 19 | mod ws; 20 | 21 | pub use error::{ParseError, ReactorError, WebSocketError}; 22 | pub use reactor::{Igniter, Reactor, ReactorShutdownSignaler}; 23 | pub use ws::{ParseBytes, WebSocketClient, WsResponse}; 24 | -------------------------------------------------------------------------------- /libsplinter/src/events/reactor/reactor_message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use futures::Future; 16 | 17 | use crate::events::ws::Listen; 18 | 19 | pub(super) enum ReactorMessage { 20 | Stop, 21 | StartWs(Listen), 22 | HttpRequest(Box + Send + 'static>), 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/connection_status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::events::WebSocketError; 16 | 17 | pub(super) enum ConnectionStatus { 18 | Open, 19 | UnexpectedClose(WebSocketError), 20 | Close(Result<(), WebSocketError>), 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/parse_bytes.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::events::ParseError; 16 | 17 | pub trait ParseBytes: Send + Sync + Clone { 18 | fn from_bytes(bytes: &[u8]) -> Result; 19 | } 20 | 21 | impl ParseBytes> for Vec { 22 | fn from_bytes(bytes: &[u8]) -> Result, ParseError> { 23 | Ok(bytes.to_vec()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/web_socket_client_cmd.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use awc::ws::Frame; 16 | 17 | pub(super) enum WebSocketClientCmd { 18 | Frame(Frame), 19 | Stop, 20 | } 21 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/ws_respoonse.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// Response object returned by `WebSocket` client callbacks. 16 | #[derive(Debug)] 17 | pub enum WsResponse { 18 | Empty, 19 | Close, 20 | Pong(String), 21 | Text(String), 22 | Bytes(Vec), 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/00000000000000_diesel_initial_setup/down.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass); 6 | DROP FUNCTION IF EXISTS diesel_set_updated_at(); 7 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-11-231339_biome_create_notifications/down.sql: -------------------------------------------------------------------------------- 1 | -- Licensed under the Apache License, Version 2.0 (the "License"); 2 | -- you may not use this file except in compliance with the License. 3 | -- You may obtain a copy of the License at 4 | -- 5 | -- http://www.apache.org/licenses/LICENSE-2.0 6 | -- 7 | -- Unless required by applicable law or agreed to in writing, software 8 | -- distributed under the License is distributed on an "AS IS" BASIS, 9 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | -- See the License for the specific language governing permissions and 11 | -- limitations under the License. 12 | -- ----------------------------------------------------------------------------- 13 | 14 | DROP TABLE notification_properties; 15 | DROP TABLE user_notifications; 16 | DROP TABLE notifications; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-213120_biome_create_users/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE splinter_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-213120_biome_create_users/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS splinter_user ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-214153_biome_create_credentials/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS user_credentials; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-12-12-200956_biome_create-keys/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE keys; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-12-12-200956_biome_create-keys/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS keys ( 17 | public_key TEXT NOT NULL, 18 | encrypted_private_key TEXT NOT NULL, 19 | user_id TEXT NOT NULL, 20 | display_name TEXT NOT NULL, 21 | PRIMARY KEY(public_key, user_id) 22 | ); 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-01-10-204453_biome_add_foreign_key_constraint/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE keys DROP CONSTRAINT biome_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-01-10-204453_biome_add_foreign_key_constraint/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE keys 17 | ADD CONSTRAINT biome_user FOREIGN KEY (user_id) REFERENCES splinter_user(id); 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-03-12-194828_biome_create_refresh_tokens/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS refresh_tokens; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-07-24-133220_registry_create/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS splinter_nodes; 17 | DROP TABLE IF EXISTS splinter_nodes_endpoints; 18 | DROP TABLE IF EXISTS splinter_nodes_keys; 19 | DROP TABLE IF EXISTS splinter_nodes_metadata; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-11-02-144300_biome_create_oauth_users/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP INDEX IF EXISTS idx_oauth_user_access_token; 17 | DROP INDEX IF EXISTS idx_oauth_user_provider_user_ref; 18 | DROP TABLE IF EXISTS oauth_user; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-02-160706_admin_add_display_name/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN display_name; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN display_name; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-02-160706_admin_add_display_name/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN display_name TEXT; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN display_name TEXT; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-08-121200-oauth-create-inflight-requests/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS oauth_inflight_request; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-11-172121_biome_remove-users-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | -- Dropping the column with `CASCADE` drops foreign key constraints from all 17 | -- tables that have this constraint 18 | ALTER TABLE splinter_user DROP COLUMN id CASCADE; 19 | 20 | DROP TABLE splinter_user; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-21-145125_admin_service_allow_null/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE proposed_circuit ALTER COLUMN application_metadata SET NOT NULL; 17 | ALTER TABLE proposed_circuit ALTER COLUMN comments SET NOT NULL; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-21-145125_admin_service_allow_null/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE proposed_circuit ALTER COLUMN application_metadata DROP NOT NULL; 17 | ALTER TABLE proposed_circuit ALTER COLUMN comments DROP NOT NULL; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TRIGGER IF EXISTS oauth_user_sessions_timestamp_update; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-30-115400_add_roles_and_assignments/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS role_permissions; 17 | DROP TABLE IF EXISTS assignments; 18 | DROP TABLE IF EXISTS roles; 19 | DROP TABLE IF EXISTS identities; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-07-083000_biome_create_profiles/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE user_profile; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-07-083000_biome_create_profiles/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS user_profile ( 17 | user_id TEXT PRIMARY KEY, 18 | subject TEXT NOT NULL UNIQUE, 19 | name TEXT, 20 | given_name TEXT, 21 | family_name TEXT, 22 | email TEXT, 23 | picture TEXT 24 | ); 25 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-08-162225_admin_service_add_circuit_version/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_version; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_version; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_version; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-08-162225_admin_service_add_circuit_version/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-14-155512_admin_service_add_circuit_status/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_status; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_status; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_status; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-14-155512_admin_service_add_circuit_status/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-01-150745_add_admin_role/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DELETE FROM roles WHERE id='admin'; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-01-150745_add_admin_role/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | INSERT INTO roles VALUES ('admin', 'Administrator'); 17 | INSERT INTO role_permissions VALUES ('admin', '*'); 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-09-042200_update-identity-enum/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TYPE identity_type AS ENUM ('key', 'user'); 17 | 18 | ALTER TABLE identities 19 | ALTER COLUMN identity_type 20 | SET DATA TYPE identity_type 21 | USING (enum_range(null::identity_type))[identity_type::int]; 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-04-13-045000_rename_rbac_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE rbac_roles RENAME TO roles; 17 | ALTER TABLE rbac_role_permissions RENAME TO role_permissions; 18 | ALTER TABLE rbac_identities RENAME TO identities; 19 | ALTER TABLE rbac_assignments RENAME TO assignments; 20 | 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-04-13-045000_rename_rbac_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE roles RENAME TO rbac_roles; 17 | ALTER TABLE role_permissions RENAME TO rbac_role_permissions; 18 | ALTER TABLE identities RENAME TO rbac_identities; 19 | ALTER TABLE assignments RENAME TO rbac_assignments; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-05-10-191805_admin_service_add_public_key/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node DROP COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member DROP COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-05-10-191805_admin_service_add_public_key/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node ADD COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member ADD COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-06-30-154942_node_id_store/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS node_id; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-06-30-154942_node_id_store/up.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS node_id ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2022-02-09-103052_remove_biome_notifications/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE notification_properties; 17 | DROP TABLE user_notifications; 18 | DROP TABLE notifications; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2022-02-17-183942_service_lifecycle/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE service_lifecycle_status; 17 | DROP TABLE service_lifecycle_argument; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-11-231339_biome_create_notifications/down.sql: -------------------------------------------------------------------------------- 1 | -- Licensed under the Apache License, Version 2.0 (the "License"); 2 | -- you may not use this file except in compliance with the License. 3 | -- You may obtain a copy of the License at 4 | -- 5 | -- http://www.apache.org/licenses/LICENSE-2.0 6 | -- 7 | -- Unless required by applicable law or agreed to in writing, software 8 | -- distributed under the License is distributed on an "AS IS" BASIS, 9 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | -- See the License for the specific language governing permissions and 11 | -- limitations under the License. 12 | -- ----------------------------------------------------------------------------- 13 | 14 | DROP TABLE notification_properties; 15 | DROP TABLE user_notifications; 16 | DROP TABLE notifications; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-213120_biome_create_users/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE splinter_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-213120_biome_create_users/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS splinter_user ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-214153_biome_create_credentials/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS user_credentials; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-12-12-200956_biome_create-keys/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE keys; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-03-12-194828_biome_create_refresh_tokens/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS refresh_tokens; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-07-24-133220_registry_create/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS splinter_nodes; 17 | DROP TABLE IF EXISTS splinter_nodes_endpoints; 18 | DROP TABLE IF EXISTS splinter_nodes_keys; 19 | DROP TABLE IF EXISTS splinter_nodes_metadata; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-10-28-135000_biome_create_oath_users/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP INDEX IF EXISTS idx_oauth_user_access_token; 17 | DROP INDEX IF EXISTS idx_oauth_user_provider_user_ref; 18 | DROP TABLE IF EXISTS oauth_user; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-02-161638_admin_add_display_name/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN display_name; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN display_name; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-02-161638_admin_add_display_name/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN display_name TEXT; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN display_name TEXT; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-08-121200-oauth-create-inflight-requests/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS oauth_inflight_request; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TRIGGER IF EXISTS oauth_user_sessions_timestamp_update; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TRIGGER oauth_user_sessions_timestamp_update 17 | AFTER UPDATE on oauth_user_sessions 18 | BEGIN 19 | UPDATE oauth_user_sessions 20 | SET last_authenticated = strftime('%s','now') 21 | WHERE splinter_access_token = old.splinter_access_token; 22 | END; 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-30-115400_add_roles_and_assignments/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS role_permissions; 17 | DROP TABLE IF EXISTS assignments; 18 | DROP TABLE IF EXISTS roles; 19 | DROP TABLE IF EXISTS identities; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-07-083000_biome_create_profiles/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE user_profile; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-07-083000_biome_create_profiles/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS user_profile ( 17 | user_id TEXT PRIMARY KEY, 18 | subject TEXT NOT NULL UNIQUE, 19 | name TEXT, 20 | given_name TEXT, 21 | family_name TEXT, 22 | email TEXT, 23 | picture TEXT 24 | ); 25 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-08-162225_admin_service_add_circuit_version/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_version; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_version; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_version; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-08-162225_admin_service_add_circuit_version/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-14-155512_admin_service_add_circuit_status/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_status; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_status; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_status; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-14-155512_admin_service_add_circuit_status/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-02-01-150745_add_admin_role/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DELETE FROM roles WHERE id='admin'; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-02-01-150745_add_admin_role/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | INSERT INTO roles VALUES ('admin', 'Administrator'); 17 | INSERT INTO role_permissions VALUES ('admin', '*'); 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-04-13-045000_rename_rbac_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE rbac_roles RENAME TO roles; 17 | ALTER TABLE rbac_role_permissions RENAME TO role_permissions; 18 | ALTER TABLE rbac_identities RENAME TO identities; 19 | ALTER TABLE rbac_assignments RENAME TO assignments; 20 | 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-04-13-045000_rename_rbac_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE roles RENAME TO rbac_roles; 17 | ALTER TABLE role_permissions RENAME TO rbac_role_permissions; 18 | ALTER TABLE identities RENAME TO rbac_identities; 19 | ALTER TABLE assignments RENAME TO rbac_assignments; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-05-10-191805_admin_service_add_public_key/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node DROP COLUMN public_key BINARY; 18 | 19 | ALTER TABLE circuit_member DROP COLUMN public_key BINARY; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-05-10-191805_admin_service_add_public_key/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node ADD COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member ADD COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-06-30-154942_node_id_store/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS node_id; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-06-30-154942_node_id_store/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS node_id ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2022-02-09-103052_remove_biome_notifications/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE notification_properties; 17 | DROP TABLE user_notifications; 18 | DROP TABLE notifications; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2022-02-17-183942_service_lifecycle/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE service_lifecycle_status; 17 | DROP TABLE service_lifecycle_argument; 18 | -------------------------------------------------------------------------------- /libsplinter/src/network/auth/state_machine/challenge_v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod accepting_action; 16 | mod accepting_state; 17 | mod initiating_action; 18 | mod initiating_state; 19 | 20 | pub(crate) use accepting_action::ChallengeAuthorizationAcceptingAction; 21 | pub(crate) use accepting_state::ChallengeAuthorizationAcceptingState; 22 | pub(crate) use initiating_action::ChallengeAuthorizationInitiatingAction; 23 | pub(crate) use initiating_state::ChallengeAuthorizationInitiatingState; 24 | -------------------------------------------------------------------------------- /libsplinter/src/network/dispatch/peer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::peer::interconnect::NetworkMessageSender; 16 | 17 | use super::{MessageSender, PeerId}; 18 | 19 | impl MessageSender for NetworkMessageSender { 20 | fn send(&self, recipient: PeerId, message: Vec) -> Result<(), (PeerId, Vec)> { 21 | NetworkMessageSender::send(self, recipient.into(), message) 22 | .map_err(|(id, msg)| (id.into(), msg)) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libsplinter/src/network/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Network connection management and message dispatching framework. 16 | 17 | pub mod auth; 18 | pub mod connection_manager; 19 | pub mod dispatch; 20 | pub mod handlers; 21 | #[cfg(feature = "runtime-service")] 22 | pub(crate) mod reply; 23 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Traits, types, and implementations for interacting with node_id's. 16 | 17 | /// Store logic for accessing and modifying an instances node_id. 18 | pub mod store; 19 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use diesel::{Insertable, Queryable}; 16 | 17 | use super::schema::node_id; 18 | 19 | #[derive(Queryable, Insertable)] 20 | #[table_name = "node_id"] 21 | pub struct NodeID { 22 | pub id: String, 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | node_id { 17 | id -> Text, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/actix/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod callback; 16 | pub(super) mod list_users; 17 | pub(super) mod login; 18 | pub(super) mod logout; 19 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/resources/callback.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Deserialize)] 16 | pub struct CallbackQuery { 17 | pub code: String, 18 | pub state: String, 19 | } 20 | 21 | pub fn generate_redirect_query(splinter_access_token: &str, display_name: &str) -> String { 22 | format!( 23 | "access_token=OAuth2:{}&display_name={}", 24 | splinter_access_token, display_name 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod callback; 16 | pub(super) mod list_users; 17 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::oauth_inflight_request; 16 | 17 | #[derive(Insertable, Queryable, Identifiable, PartialEq, Eq, Debug)] 18 | #[table_name = "oauth_inflight_request"] 19 | pub struct OAuthInflightRequest { 20 | pub id: String, 21 | pub pkce_verifier: String, 22 | pub client_redirect_url: String, 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | oauth_inflight_request (id) { 17 | id -> Text, 18 | pkce_verifier -> Text, 19 | client_redirect_url -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/rbac/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "store")] 16 | pub mod store; 17 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/maintenance/routes/resources.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module provides resources for the maintenance mode authorization handler's REST API 16 | //! endpoints 17 | 18 | #[derive(Deserialize)] 19 | pub struct PostMaintenanceModeQuery { 20 | pub enabled: bool, 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/rbac/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | pub mod rest_api; 17 | 18 | pub use handler::RoleBasedAuthorizationHandler; 19 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/routes/resources.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Resources for the authorization tools' REST API endpoints 16 | 17 | #[derive(Serialize)] 18 | pub struct PermissionResponse { 19 | pub permission_id: &'static str, 20 | pub permission_display_name: &'static str, 21 | pub permission_description: &'static str, 22 | } 23 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/errors/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod request_error; 16 | mod rest_api_server_error; 17 | 18 | pub use request_error::RequestError; 19 | pub use rest_api_server_error::RestApiServerError; 20 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "runtime-service")] 16 | pub mod service; 17 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/dispatch/type_resolver.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::error::InternalError; 16 | use crate::service::{FullyQualifiedServiceId, ServiceType}; 17 | 18 | pub trait ServiceTypeResolver { 19 | fn resolve_type( 20 | &self, 21 | service_id: &FullyQualifiedServiceId, 22 | ) -> Result, InternalError>; 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/instance/orchestrator/endpoint_provider.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/lifecycle_executor/executor/message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! The message used by the LifecycleExecutor to know when to execute service handler 16 | 17 | use crate::service::{FullyQualifiedServiceId, ServiceType}; 18 | 19 | #[derive(Clone, Debug)] 20 | pub enum ExecutorMessage { 21 | WakeUpAll, 22 | WakeUp { 23 | service_type: ServiceType<'static>, 24 | service_id: Option, 25 | }, 26 | Shutdown, 27 | } 28 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/timer/alarm/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! An alarm can be used to prematurely wake all or specific message handlers 16 | mod channel; 17 | 18 | pub use channel::{ChannelTimerAlarm, ChannelTimerAlarmFactory}; 19 | -------------------------------------------------------------------------------- /libsplinter/src/service/id/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Definitions of structs which represent circuit and service identifiers. 16 | 17 | mod circuit; 18 | mod qualified; 19 | mod service; 20 | 21 | pub use circuit::CircuitId; 22 | pub use qualified::FullyQualifiedServiceId; 23 | pub use service::ServiceId; 24 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/factory/endpoint.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::service::rest_api::ServiceEndpointProvider; 16 | 17 | pub trait EndpointFactory { 18 | /// Get the [`ServiceEndpoint`] definitions that represent the REST API resources provided by 19 | /// the services that this factory can create. 20 | /// 21 | /// [`ServiceEndpoint`]: rest_api/struct.ServiceEndpoint.html 22 | fn get_rest_endpoint_provider(&self) -> Box; 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/factory/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "rest-api-actix-web-1")] 16 | mod endpoint; 17 | mod service; 18 | 19 | #[cfg(feature = "rest-api-actix-web-1")] 20 | pub use endpoint::EndpointFactory; 21 | pub use service::ServiceFactory; 22 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/message_context.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// The ServiceMessageContext is a struct that provides information about an incoming message. 16 | #[derive(Clone, Debug)] 17 | pub struct ServiceMessageContext { 18 | pub sender: String, 19 | pub circuit: String, 20 | pub correlation_id: String, 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/orchestrator/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod factory; 16 | mod service; 17 | 18 | pub use factory::OrchestratableServiceFactory; 19 | pub use service::OrchestratableService; 20 | -------------------------------------------------------------------------------- /libsplinter/src/service/routable.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Contains `Routable` trait. 16 | 17 | use super::ServiceType; 18 | 19 | /// Links a component to specific service types. 20 | pub trait Routable { 21 | /// Return a list of associated `ServiceTypes` 22 | fn service_types(&self) -> &[ServiceType]; 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/threading/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::{error, fmt}; 16 | 17 | #[derive(Clone, Debug, PartialEq, Eq)] 18 | pub struct PacemakerStartError(pub String); 19 | 20 | impl error::Error for PacemakerStartError {} 21 | 22 | impl fmt::Display for PacemakerStartError { 23 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 24 | write!(f, "Pacemaker was unable to start: {}", self.0) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libsplinter/src/threading/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module will contain components that will be used to support different threading models 16 | 17 | pub(crate) mod error; 18 | pub mod lifecycle; 19 | pub(crate) mod pacemaker; 20 | pub(crate) mod pool; 21 | -------------------------------------------------------------------------------- /libsplinter/src/transport/raw.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub use super::socket::TcpTransport as RawTransport; 16 | -------------------------------------------------------------------------------- /libsplinter/src/transport/socket/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod frame; 16 | mod tcp; 17 | mod tls; 18 | 19 | pub use tcp::TcpTransport; 20 | pub use tls::{TlsConnection, TlsInitError, TlsTransport}; 21 | 22 | #[cfg(test)] 23 | pub mod tests { 24 | pub use super::tls::tests::create_test_tls_transport; 25 | } 26 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | pub mod v2; 17 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines the REST API resources for protocol version 1 16 | 17 | pub(in super::super) mod circuits; 18 | pub(in super::super) mod circuits_circuit_id; 19 | pub(in super::super) mod proposals; 20 | pub(in super::super) mod proposals_circuit_id; 21 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/v2/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines the REST API resources for protocol version 2 16 | pub(in super::super) mod circuits; 17 | pub(in super::super) mod circuits_circuit_id; 18 | pub(in super::super) mod proposals; 19 | pub(in super::super) mod proposals_circuit_id; 20 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/biome/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "biome-key-management")] 16 | pub mod key_management; 17 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/registry/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod nodes; 16 | pub(super) mod nodes_identity; 17 | -------------------------------------------------------------------------------- /rest_api/actix_web_4/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /rest_api/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod error; 16 | pub mod paging; 17 | #[cfg(feature = "scabbard")] 18 | pub mod scabbard; 19 | pub mod status; 20 | 21 | pub const SPLINTER_PROTOCOL_VERSION: u32 = 2; 22 | -------------------------------------------------------------------------------- /rest_api/common/src/paging/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // There are at least three versions of Request in this crate so the rename is 16 | // worth it. 17 | 18 | pub mod v1; 19 | -------------------------------------------------------------------------------- /rest_api/common/src/scabbard/batches.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::Serialize; 16 | 17 | #[derive(Debug, Clone, PartialEq, Eq, Serialize)] 18 | pub struct BatchLinkResponse<'a> { 19 | link: &'a str, 20 | } 21 | 22 | impl<'a> From<&'a str> for BatchLinkResponse<'a> { 23 | fn from(link: &'a str) -> Self { 24 | Self { link } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/echo/libecho/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::extra_unused_lifetimes)] 16 | 17 | #[cfg(feature = "diesel_migrations")] 18 | pub mod migrations; 19 | pub mod service; 20 | pub mod store; 21 | 22 | #[macro_use] 23 | #[cfg(any(feature = "sqlite", feature = "postgres"))] 24 | extern crate diesel; 25 | #[cfg(feature = "diesel_migrations")] 26 | #[macro_use] 27 | extern crate diesel_migrations; 28 | #[macro_use] 29 | extern crate serde; 30 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/postgres/migrations/2022-03-03-141100_create_echo_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | 15 | DROP TABLE echo_services; 16 | DROP TABLE echo_peers; 17 | DROP TABLE echo_requests; 18 | DROP TABLE echo_request_errors; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/sqlite/migrations/2022-01-27-205126_create_echo_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | 15 | DROP TABLE IF EXISTS echo_services; 16 | DROP TABLE IF EXISTS echo_peers; 17 | DROP TABLE IF EXISTS echo_requests; 18 | DROP TABLE IF EXISTS echo_request_errors; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "diesel")] 16 | pub mod diesel; 17 | 18 | #[cfg(feature = "postgres")] 19 | pub use self::diesel::postgres::run_migrations as run_postgres_migrations; 20 | #[cfg(feature = "sqlite")] 21 | pub use self::diesel::sqlite::run_migrations as run_sqlite_migrations; 22 | -------------------------------------------------------------------------------- /services/echo/libecho/src/service/message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub enum EchoMessage { 16 | Request { 17 | message: String, 18 | correlation_id: u64, 19 | }, 20 | Response { 21 | message: String, 22 | correlation_id: u64, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /services/echo/libecho/src/service/status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Clone, Debug, PartialEq, Eq)] 16 | pub enum EchoServiceStatus { 17 | Prepared, 18 | Finalized, 19 | Retired, 20 | } 21 | -------------------------------------------------------------------------------- /services/echo/libecho/src/store/command/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod finalize_service; 16 | mod prepare_service; 17 | mod purge_service; 18 | mod retire_service; 19 | 20 | pub use finalize_service::EchoFinalizeServiceCommand; 21 | pub use prepare_service::EchoPrepareServiceCommand; 22 | pub use purge_service::EchoPurgeServiceCommand; 23 | pub use retire_service::EchoRetireServiceCommand; 24 | -------------------------------------------------------------------------------- /services/scabbard/cli/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for `scabbard` will be 2 | located. 3 | -------------------------------------------------------------------------------- /services/scabbard/cli/packaging/ubuntu/postinst: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-09-02-1355000-create-commit-log-tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-09-02-1355000-create-commit-log-tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS scabbard_commit_log ( 17 | circuit_id TEXT NOT NULL, 18 | service_id TEXT NOT NULL, 19 | commit_hash TEXT NOT NULL, 20 | PRIMARY KEY (circuit_id, service_id) 21 | ); 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-10-05-1414000-rename-commit-log-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_hash RENAME TO scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-10-05-1414000-rename-commit-log-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_log RENAME TO scabbard_commit_hash; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-05-153027_scabbard_commit_history/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_service; 17 | DROP TABLE IF EXISTS scabbard_peer; 18 | DROP TABLE IF EXISTS scabbard_v3_commit_history; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-160128_add_consensus/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_service DROP COLUMN consensus; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-160128_add_consensus/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | CREATE TYPE scabbard_consensus AS ENUM ('2PC'); 16 | 17 | ALTER TABLE scabbard_service 18 | ADD COLUMN consensus scabbard_consensus NOT NULL Default '2PC'; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-174800_scabbard_consensus_event_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS consensus_2pc_event; 17 | DROP TABLE IF EXISTS consensus_2pc_deliver_event; 18 | DROP TABLE IF EXISTS consensus_2pc_start_event; 19 | DROP TABLE IF EXISTS consensus_2pc_vote_event; 20 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-05-05-142800-create-scabbard-alarm-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_alarm; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-06-08-133219-remove-action-and-event-position/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_action DROP COLUMN position; 17 | 18 | ALTER TABLE consensus_2pc_event DROP COLUMN position; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-06-16-154357_supervisor/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE supervisor_notification; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-08-133500-add-consensus-2pc-views/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_actions_all; 17 | DROP VIEW consensus_2pc_events_all; 18 | DROP VIEW consensus_2pc_actions_and_events_all; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-25-085317-add-update-context-action-id/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_event DROP COLUMN update_context_action_id; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-25-151237-add-consensus-2pc-event-context-view/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the Licens 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apachorg/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the Licens 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_events_and_contexts_all; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-09-02-1355000-create-commit-log-tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-09-02-1355000-create-commit-log-tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS scabbard_commit_log ( 17 | circuit_id TEXT NOT NULL, 18 | service_id TEXT NOT NULL, 19 | commit_hash TEXT NOT NULL, 20 | PRIMARY KEY (circuit_id, service_id) 21 | ); 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-10-05-1414000-rename-commit-log-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_hash RENAME TO scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-10-05-1414000-rename-commit-log-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_log RENAME TO scabbard_commit_hash; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-05-153027_scabbard_commit_history/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_service; 17 | DROP TABLE IF EXISTS scabbard_peer; 18 | DROP TABLE IF EXISTS scabbard_v3_commit_history; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-21-160128_add_consensus/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_service 17 | ADD COLUMN consensus Text NOT NULL DEFAULT '2PC' 18 | CHECK ( consensus IN ('2PC') ); 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-21-174800_scabbard_consensus_event_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS consensus_2pc_event; 17 | DROP TABLE IF EXISTS consensus_2pc_deliver_event; 18 | DROP TABLE IF EXISTS consensus_2pc_start_event; 19 | DROP TABLE IF EXISTS consensus_2pc_vote_event; 20 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-05-05-142800-create-scabbard-alarm-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_alarm; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-06-16-154357_supervisor/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE supervisor_notification; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-08-133500-add-consensus-2pc-views/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_actions_all; 17 | DROP VIEW consensus_2pc_events_all; 18 | DROP VIEW consensus_2pc_actions_and_events_all; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-25-085317-add-update-context-action-id/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_event DROP COLUMN update_context_action_id; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-25-151237-add-consensus-2pc-event-context-view/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the Licens 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apachorg/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the Licens 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_events_and_contexts_all; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "scabbardv3")] 16 | pub mod v3; 17 | 18 | pub const SCABBARD_PROTOCOL_VERSION: u32 = 1; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/protocol/v3/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod message; 16 | pub mod two_phase_commit; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/factory/endpoint_provider.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/rest_api/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/v3/consensus/consensus_action_runner/commands/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module contains the commands that will be used by the `ConsensusActionRunner` 16 | 17 | pub mod actions; 18 | pub mod context; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/v3/publisher/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod artifact; 16 | mod publisher_context; 17 | 18 | pub use artifact::{SignedTimestamp, SignedTimestampCreator, SignedTimestampCreatorFactory}; 19 | pub use publisher_context::ScabbardPublishingContext; 20 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/command/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod finalize_service; 16 | mod prepare_service; 17 | mod purge_service; 18 | mod retire_service; 19 | 20 | pub use finalize_service::ScabbardFinalizeServiceCommand; 21 | pub use prepare_service::ScabbardPrepareServiceCommand; 22 | pub use purge_service::ScabbardPurgeServiceCommand; 23 | pub use retire_service::ScabbardRetireServiceCommand; 24 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::*; 16 | 17 | #[derive(Insertable, Identifiable, AsChangeset)] 18 | #[cfg_attr(test, derive(Debug, PartialEq))] 19 | #[table_name = "scabbard_commit_hash"] 20 | #[primary_key(circuit_id, service_id)] 21 | pub struct NewCommitHash<'a> { 22 | pub circuit_id: &'a str, 23 | pub service_id: &'a str, 24 | pub commit_hash: &'a str, 25 | } 26 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod get_current_commit_hash; 16 | pub(super) mod set_current_commit_hash; 17 | 18 | pub struct CommitHashStoreOperations<'a, C> { 19 | conn: &'a C, 20 | } 21 | 22 | impl<'a, C: diesel::Connection> CommitHashStoreOperations<'a, C> { 23 | pub fn new(conn: &'a C) -> Self { 24 | CommitHashStoreOperations { conn } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | scabbard_commit_hash (circuit_id, service_id) { 17 | circuit_id -> Text, 18 | service_id -> Text, 19 | commit_hash -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/alarm.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Debug, PartialEq, Eq, Clone)] 16 | pub enum AlarmType { 17 | TwoPhaseCommit, 18 | } 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/identified.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// A struct used to pair a type to an ID 16 | #[derive(Debug, PartialEq, Eq, Clone)] 17 | pub struct Identified { 18 | pub id: i64, 19 | pub record: T, 20 | } 21 | 22 | impl Identified { 23 | pub fn deconstruct(self) -> (i64, T) { 24 | (self.id, self.record) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/two_phase_commit/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Structs and enums specific to the two phase commit consensus algorithm 16 | 17 | mod action; 18 | mod context; 19 | mod event; 20 | mod message; 21 | mod state; 22 | 23 | pub use action::{Action, Notification}; 24 | pub use context::{Context, ContextBuilder, Participant}; 25 | pub use event::Event; 26 | pub use message::Message; 27 | pub use state::State; 28 | -------------------------------------------------------------------------------- /splinterd/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for `splinterd` will 2 | be located. 3 | -------------------------------------------------------------------------------- /splinterd/packaging/systemd/splinterd: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #SPLINTERD_ARGS= 16 | -------------------------------------------------------------------------------- /splinterd/packaging/systemd/splinterd.service: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [Unit] 16 | Description=Splinter Daemon 17 | After=network-online.target 18 | 19 | [Service] 20 | User=splinterd 21 | Group=splinterd 22 | EnvironmentFile=-/etc/default/splinterd 23 | ExecStart=/usr/bin/splinterd $SPLINTERD_ARGS 24 | Restart=on-failure 25 | RestartSec=300 26 | 27 | [Install] 28 | WantedBy=multi-user.target 29 | -------------------------------------------------------------------------------- /splinterd/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #[cfg(feature = "node")] 15 | #[macro_use] 16 | extern crate log; 17 | #[cfg(feature = "node")] 18 | pub mod node; 19 | -------------------------------------------------------------------------------- /splinterd/src/node/running/biome.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module defines the running biome subsystem. 16 | 17 | use splinter::biome::UserProfileStore; 18 | 19 | pub struct BiomeSubsystem { 20 | pub(crate) profile_store: Box, 21 | } 22 | 23 | impl BiomeSubsystem { 24 | pub fn user_profile_store(&self) -> &dyn UserProfileStore { 25 | &*self.profile_store 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /splinterd/tests/admin_service.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Splinter integration tests. 16 | 17 | // macros_use must come before any modules that make use of the macro 18 | #[macro_use] 19 | mod framework; 20 | 21 | #[cfg(feature = "node")] 22 | mod admin; 23 | -------------------------------------------------------------------------------- /splinterd/tests/framework/circuit_builder/veil/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Veils that can be used with [`CircuitBuilder`] 16 | 17 | pub mod scabbard; 18 | -------------------------------------------------------------------------------- /splinterd/tests/framework/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! A framework for running a network of Splinter nodes in a single process for 16 | //! integration testing purposes. 17 | 18 | #[cfg(feature = "node")] 19 | pub mod network; 20 | #[macro_use] 21 | #[cfg(feature = "node")] 22 | pub mod shutdown; 23 | #[cfg(feature = "node")] 24 | pub mod circuit_builder; 25 | -------------------------------------------------------------------------------- /tests/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /tests/migrations/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | --------------------------------------------------------------------------------