Class RemoteMdibAccessImpl

    • Method Detail

      • writeDescription

        public WriteDescriptionResult writeDescription​(MdibVersion mdibVersion,
                                                       @Nullable
                                                       BigInteger mdDescriptionVersion,
                                                       @Nullable
                                                       BigInteger mdStateVersion,
                                                       MdibDescriptionModifications mdibDescriptionModifications)
                                                throws PreprocessingException
        Description copied from interface: RemoteMdibAccess
        Processes the description modifications object, stores the data internally and trigger an event.

        Data is passed through if the elements of the modification change set do not violate the MDIB storage.

        Attention: description modifications are expensive. Even if this operation allows to change states, it should only be used for changes that affect descriptors.

        Specified by:
        writeDescription in interface RemoteMdibAccess
        Parameters:
        mdibVersion - the MDIB version to apply.
        mdDescriptionVersion - the MD description version to apply. Leave null if unknown.
        mdStateVersion - the MD state version to apply. Leave null if unknown.
        mdibDescriptionModifications - a set of insertions, updates and deletes.
        Returns:
        a write result including inserted, updates and deleted entities.
        Throws:
        PreprocessingException - if something goes wrong during preprocessing, i.e., the consistency of the MDIB would be violated.
      • writeStates

        public WriteStateResult writeStates​(MdibVersion mdibVersion,
                                            MdibStateModifications mdibStateModifications)
                                     throws PreprocessingException
        Description copied from interface: RemoteMdibAccess
        Processes the state modifications object, stores the data internally and triggers an event.

        Data is passed through if the elements of the modification change set do not violate the MDIB storage.

        Hint: this function cheap in terms of runtime and should be used for state changes.

        Specified by:
        writeStates in interface RemoteMdibAccess
        Parameters:
        mdibVersion - the MDIB version to apply.
        mdibStateModifications - a set of state updates.
        Returns:
        a write result including the updated entities.
        Throws:
        PreprocessingException - if something goes wrong during preprocessing, i.e., the consistency of the MDIB would be violated.
      • getMdibVersion

        public MdibVersion getMdibVersion()
        Description copied from interface: MdibAccess
        The latest known MDIB version.

        This object returns the last known MDIB version which in case of remote access may not necessarily reflect the MDIB version of the whole MDIB. For local access the MDIB version reflects the latest state.

        Specified by:
        getMdibVersion in interface MdibAccess
        Returns:
        the latest known MDIB version.
      • getMdDescriptionVersion

        public BigInteger getMdDescriptionVersion()
        Description copied from interface: MdibAccess
        The latest known MD description version.

        This object returns the last known MDIB version which in case of remote access may be outdated. For local access the MD description version reflects the latest state.

        Specified by:
        getMdDescriptionVersion in interface MdibAccess
        Returns:
        the latest known MD description version.
      • getMdStateVersion

        public BigInteger getMdStateVersion()
        Description copied from interface: MdibAccess
        The latest known MD description version.

        This object returns the last known MDIB version which in case of remote access may be outdated. For local access the MD description version reflects the latest state.

        Specified by:
        getMdStateVersion in interface MdibAccess
        Returns:
        The latest known MD state version.
      • getState

        public Optional<AbstractState> getState​(String handle)
        Description copied from interface: MdibAccess
        Retrieves a specific abstract state of the hosted Mdib.
        Specified by:
        getState in interface MdibAccess
        Parameters:
        handle - the state or descriptor handle of the state to request (descriptor handle is used in case of single states).
        Returns:
        Optional of the requested state or Optional.empty() if not found or something went wrong.
      • getState

        public <T extends AbstractStateOptional<T> getState​(String handle,
                                                              Class<T> stateClass)
        Description copied from interface: MdibAccess
        Retrieves a specific state of the hosted Mdib.
        Specified by:
        getState in interface MdibAccess
        Type Parameters:
        T - any state type.
        Parameters:
        handle - the state or descriptor handle of the state to request (descriptor handle is used in case of single states).
        stateClass - the class to cast to. If cast fails, Optional.empty() will be returned.
        Returns:
        Optional of the requested state or Optional.empty() if not found or something went wrong.
      • getContextStates

        public <T extends AbstractContextStateList<T> getContextStates​(String descriptorHandle,
                                                                         Class<T> stateClass)
        Description copied from interface: MdibAccess
        Finds all context states of a certain descriptor given a state class.

        Attention: collections may be created on function call, hence be careful with performance issues.

        Specified by:
        getContextStates in interface MdibAccess
        Type Parameters:
        T - any context state type.
        Parameters:
        descriptorHandle - the descriptor handle to seek.
        stateClass - the class to filter for.
        Returns:
        a list of the context states of descriptorHandle.
      • getContextStates

        public List<AbstractContextState> getContextStates​(String descriptorHandle)
        Description copied from interface: MdibAccess
        Finds all context states of a certain descriptor.

        Attention: collections may be created on function call, hence be careful with performance issues.

        Specified by:
        getContextStates in interface MdibAccess
        Parameters:
        descriptorHandle - the descriptor handle to seek.
        Returns:
        a list of the context states of descriptorHandle.
      • getContextStates

        public List<AbstractContextState> getContextStates()
        Description copied from interface: MdibAccess
        Gets all context states.

        Attention: collections may be created on function call, hence be careful with performance issues.

        Specified by:
        getContextStates in interface MdibAccess
        Returns:
        a list of all context states.
      • findContextStatesByType

        public <T extends AbstractContextStateList<T> findContextStatesByType​(Class<T> stateClass)
        Description copied from interface: MdibAccess
        Gets all context states of a specific type.

        Attention: collections may be created on function call, hence be careful with performance issues.

        Specified by:
        findContextStatesByType in interface MdibAccess
        Type Parameters:
        T - the type to filter for.
        Parameters:
        stateClass - the class information to filter for.
        Returns:
        a list of all context states of the specific type.
      • findEntitiesByType

        public <T extends AbstractDescriptorCollection<MdibEntity> findEntitiesByType​(Class<T> type)
        Description copied from interface: MdibAccess
        Searches all entities that match a specific type.
        Specified by:
        findEntitiesByType in interface MdibAccess
        Type Parameters:
        T - the descriptor type defined by the class.
        Parameters:
        type - the class to filter for.
        Returns:
        a collection of entities where type matches.
      • getChildrenByType

        public <T extends AbstractDescriptorList<MdibEntity> getChildrenByType​(String handle,
                                                                                 Class<T> type)
        Description copied from interface: MdibAccess
        Resolves the children of a specific type given a parent handle.
        Specified by:
        getChildrenByType in interface MdibAccess
        Type Parameters:
        T - the descriptor type defined by the class.
        Parameters:
        handle - the parent handle of the entity.
        type - The class to filter for.
        Returns:
        a list of children that matches type (while preserving ordering).
      • startTransaction

        public ReadTransaction startTransaction()
        Description copied from interface: ReadTransactionProvider
        Starts a read transaction.

        Use the read transaction in an auto-closeable try... block in order to ensure releasing the lock that is gained before this function returns.

        Specified by:
        startTransaction in interface ReadTransactionProvider
        Returns:
        a new locked MDIB access transaction to operate on (read-only).