[MDSAL-460] Define a replacement for LogicalDatastoreType Created: 03/Jul/19  Updated: 09/Jan/24

Status: Confirmed
Project: mdsal
Component/s: Binding API, DOM API
Affects Version/s: None
Fix Version/s: 14.0.0

Type: Story Priority: Medium
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MDSAL-844 Disconnect (DOM)DataTreeIdentifier fr... Resolved
relates to YANGTOOLS-1012 Improve RFC8528/RFC8525 parsing inter... Confirmed
Epic Link: NMDA support

 Description   

YANG models are giving us a relatively-usable model of datastores, each defined as an identity. As YANG cannot define an abstract identity, some of these are not valid as datastore identifiers, but otherwise the generated classes should be okay.

Unfortunately this extensibility also means we can no longer maintain common.api.LogicalDatastoreType as a common enumeration shared by Binding and DOM.

In DOM world, a datastore is identified by its identity – hence it is a QName wrapped in a dom.api-specific final class. Note this class:

  • must be a value object, i.e. no externally-visible constructors
  • must be a WritableObject
  • must validate the QName against well-known abstract identities
  • must maintain a cache and/or an Interner

In Binding world, we can use generated classes directly and spell out that certain classes are invalid. binding.api implementations should consider enforcing this, although such checks should not be on critical paths.

Migration of LogicalDatastoreType.OPERATIONAL is straightforward, as it means operational store in both worlds. Slight twist in this regard is that there may be users who use this datastore as <intended> – which is not an immediate problem, but applications need to be advised to consider whether they want to work in <intended> as well – once we have that datastore supported.

Migration of LogicalDatastoreType.CONFIGURATION is less straightforward. In local (MD-SAL) context, this datastore corresponds to a fusion of the old 'config=true' datastores. The datastore itself represents <running>. MD-SAL does not support an explicit <candidate> store simply because of its transactional nature: each transaction is an isolated candidate store. Furthermore interaction between <running> and <startup> is left an implementation/use case detail – CDS persists at each committed transaction, IMDS never persists.

Therefore CONFIGURATION really means <running>, with the above restrictions. We will not define handling for <startup> and <candidate> – these will remain undefined in core APIs and will cause run-time failures if they are attempted to be used in contexts which do not support them.



 Comments   
Comment by Robert Varga [ 25/Jul/19 ]

YANGTOOLS-1012 delivers DatastoreIdentifier, which acts as the identifier for datastores in yang-data-api. It satisfies the requirements for the replacement class.

Comment by Robert Varga [ 25/Jul/19 ]

Once we have yangtools-3.0.4, we can concentrate on providing a migration path – such as an efficient codec.

Comment by Robert Varga [ 09/Dec/23 ]

Once we have disconnected serialization of DOMDataTreeIdentifier (and do not need backwards read compatibility), we can start exploring having two versions on DOMDataTreeIdentifier:

sealed interface DOMDataTreeIdentifier {
    non-sealed interface Classic extends DOMDataTreeIdentifier, LogicalDatastorePath {
        // Works with LogicalDatastoreType
    }

    non-sealed interface NMDA extends DOMDataTreeIdentifier, LogicalDataStorePath {
        // Works with datastore QNames
    }
}

the same story holds for DataTreeIdentifier, except here we would use BindingIdentity-derived generated classes.

Generated at Wed Feb 07 20:09:52 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.