Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1503

Disconnect NamespaceStmtCtx from Current and StmtContext

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Won't Do
    • None
    • None
    • parser

    Description

      The two user-facing contexts expose namespace access, each of which requires resolving a NamespaceAccess – which ends up going to BuildGlobalContext.

      This is currently dictated by legacy class hierarchy and APIs, but we should be able to disconnect these three and passing around a NamespaceCtx:

       

      interface NamespaceCtx {
       
          <K, V> @Nullable Map<K, V> namespace(CommonStmtCtx stmt, ParserNamespace<K, V> namespace);
      
          <K, V> @Nullable V namespaceItem(CommonStmtCtx stmt, ParserNamespace<K, V> namespace, K key);
      
          <K, V> @Nullable Map<K, V> localNamespacePortion(CommonStmtCtx stmt, ParserNamespace<K, V> namespace);
      }
      

      to all methods which are allowed to access namespaces.

       

      The reactor would implement this through BuildGlobalContext, which would mean that AbstractStorageNode would not need accessNamespace(). There are two wrinkles:

      1. the need to cast stmt to ReactorStmtCtx – which is essentially fine
      2. the amount of API changes – which entails a lot of work

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              rovarga Robert Varga
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: