Skip to content
Snippets Groups Projects

ENH: Add minimal functionality

Merged Florian Spreckelsen requested to merge f-minimal into dev

Summary

See https://gitlab.indiscale.com/caosdb/customers/lfpb/management/-/issues/381. Review is done in https://gitlab.com/caosdb/caosdb-julialib/-/merge_requests/2

Insert a meaningful description for this merge request here.  What is the
new/changed behavior? Which bug has been fixed? Are there related Issues?

Focus

Point the reviewer to the core of the code change. Where should they start
reading? What should they focus on (e.g. security, performance,
maintainability, user-friendliness, compliance with the specs, finding more
corner cases, concrete questions)?

Test Environment

How to set up a test environment for manual testing?

Check List for the Author

Please, prepare your MR for a review. Be sure to write a summary and a focus and create gitlab comments for the reviewer. They should guide the reviewer through the changes, explain your changes and also point out open questions. For further good practices have a look at our review guidelines

  • All automated tests pass
  • Reference related Issues
  • Up-to-date CHANGELOG.md
  • Annotations in code (Gitlab comments)
    • Intent of new code
    • Problems with old code
    • Why this implementation?

Check List for the Reviewer

  • I understand the intent of this MR
  • All automated tests pass
  • Up-to-date CHANGELOG.md
  • The test environment setup works and the intended behavior is reproducible in the test environment
  • In-code documentation and comments are up-to-date.
  • Check: Are there spezifications? Are they satisfied?

For further good practices have a look at our review guidelines.

Edited by Florian Spreckelsen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
482
483 end
484
485 provider = create_pem_file_certificate_provider(cacert)
486 authenticator =
487 CaosDB.Authentication.create_plain_password_authenticator(username, password)
488 config = create_tls_connection_configuration(host, port, authenticator, provider)
489 connection = create_connection(config)
490 print_version_info(connection)
491
492 return connection
493
494 end
495
496 end # Connection
142 include("Connection.jl")
  • 81 81 mutable struct _Authenticator
    82 82 wrapped_authenticator::Ptr{Cvoid}
    83 83
    84 function _Authenticator()
    84 function _Authenticator(managed_by_julia::Bool = false)
    • We changed the way of adding a finalizer to the objects again. There are cases -- most importantly, connections managed by libcaosdb's connection manager -- in which the wrapped object is created and destroyed by the owning cpp object. In order to prevent errors when Julia tries to delete the structs, we now have to explicitly state when the wrapped objects have to be deleted by the finalizer.

      However this is not important to almost all users since they never interact with these kind of objects anyway. They'll rather use high-level functions like connect instead, or, alternatively, will use create_something.

    • Please register or sign in to reply
  • src/Connection.jl 0 → 100644
    109 end
    110 finalizer(f, config)
    111 end
    112 return config
    113 end
    114 end
    115
    116 """
    117 create_pem_file_certificate_provider(path::AbstractString)
    118
    119 Return a `_CertificateProvider` for the pem certificate located at
    120 `path`.
    121 """
    122 function create_pem_file_certificate_provider(path::AbstractString)
    123
    124 cert_provider = Ref{_CertificateProvider}(_CertificateProvider(true))
  • src/Connection.jl 0 → 100644
    227 )
    228
    229 if err_code != 0
    230
    231 @error "Creating connection failed with code $err_code."
    232
    233 end
    234
    235 return connection
    236
    237 end
    238
    239
    240 function get_connection(name::AbstractString = "default")
    241
    242 connection = Ref{_Connection}(_Connection())
  • src/Connection.jl 0 → 100644
    355 could be a valid port, too, i.e. the CaosDB server is available at
    356 `host` without a port.
    357 - `cacert::AbstractString=""`: The path to the SSL certificate of the
    358 CaosDB server. If none is provided, the `CAOSDB_SERVER_CERT`
    359 environmental variable is used instead.
    360 - `username::AbstractString=""`: The username with which to log in
    361 into the CaosDB server. If none is provided, the `CAOSDB_USER`
    362 environmental variable is used instead. If that's not defined,
    363 "admin" is used.
    364 - `password::AbstractString="undefined"`: The password with which to
    365 log in into the CaosDB server. If none is provided, the
    366 `CAOSDB_PASSWORD` environmental variable is used instead. If that's
    367 not defined, "caosdb" is used. The default value is "undefined"
    368 rather than an empty string to allow an empty password.
    369 """
    370 function connect_manually(;
  • added 3 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 4 commits

    • 7284c8d7 - ENH: Add evaluation of return codes and errors
    • f4041bad - TST: Add tests for errors
    • cdb670c0 - ENH: Introduce abstract CaosDB exception type
    • 8fadd682 - STY: autoformat

    Compare with previous version

  • added 1 commit

    • 734fcb89 - MAINT: Make GenericCaosDBException public

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 3 3 #
    4 4 # Copyright (C) 2021 Indiscale GmbH <info@indiscale.com>
    5 5 # Copyright (C) 2021 Florian Spreckelsen <f.spreckelsen@indiscale.com>
    6 # Copyright (C) 2021 Alexander Kreft
  • added 2 commits

    • 78f93340 - MAINT: Add Logging as a dependency
    • 8c05bf53 - ENH: Add logging messages for return codes <0

    Compare with previous version

  • 70
    71 Evaluate the return code of a libccaosdb ccall and raise a
    72 `GenericCaosDBException` in case of a non-zero return code.
    73 """
    74 function evaluate_return_code(code::Cint)
    75 if code != 0
    76 msg = ccall(
    77 (:caosdb_get_status_description, CaosDB.library_name),
    78 Cstring,
    79 (Cint,),
    80 code,
    81 )
    82 if code > 0
    83 throw(GenericCaosDBException(unsafe_string(msg), code))
    84 else
    85 @info CaosDBMessage(unsafe_string(msg), code)
    • Inform about status but don't return or throw anything in case of an ongoing transaction. This is implemented so that the functionality is already here, and so that no errors are raised erroneously in case of status codes <0, but this should only become relevant to Julia (or any higher order client) once we have real asynchronous transactions in the cpp-Client. This is probably something for 0.2 and for after August 31.

    • Please register or sign in to reply
  • Florian Spreckelsen changed the description

    changed the description

  • Florian Spreckelsen marked this merge request as ready

    marked this merge request as ready

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading