"Fossies" - the Fresh Open Source Software Archive

Member "muscle/html/muscle-by-example/docs/srsreplymessages.md" (8 Jun 2019, 7223 Bytes) of package /linux/privat/muscle7.30.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Result Messages Page Overview

Result codes

This is a partial list – the full list of result codes can be seen here.

   void ParseIncomingDataItemsMessage(const MessageRef & msg)
   {
      if (msg()->what != PR_RESULT_DATAITEMS) return;  // sanity check

      const String * deletedNodePath;
      for (int i=0; (msg()->FindString(PR_NAME_REMOVED_DATAITEMS, i, &deletedNodePath) == B_NO_ERROR); i++)
      {
         printf("Subscribed node at path [%s] was deleted!\n", deletedNodePath->Cstr());
      }

      for (MessageFieldNameIterator iter = msg()->GetFieldNameIterator(B_MESSAGE_TYPE); iter.HasData(); iter++)
      {
         const String & np = iter.GetFieldName();
         MessageRef dataMsg;
         for (int32 i=0; msg()->FindMessage(np, i, dataMsg) == B_NO_ERROR; i++)
         {
            printf("Subscribed node at path [%s] was updated!\n", np());
            printf("New Message payload for that path is:\n");
            dataMsg()->PrintToStream();
         }
      }
   }
  
   // This table holds the child-node-names-in-index-order list for each 
   // ordered-index-node that the client is subscribed to
   Hashtable<String, Queue<String> > indices;  // nodepath -> index

   void ParseIncomingIndexUpdatedMessage(const MessageRef & msg)
   {
      if (msg()->what != PR_RESULT_INDEXUPDATED) return;  // sanity check

      for (MessageFieldNameIterator iter = msg()->GetFieldNameIterator(B_STRING_TYPE); iter.HasData(); iter++)
      {
         const String & parentNodePath = iter.GetFieldName();
         printf("Parsing index updates for DataNode at [%s]\n", parentNodePath());

         const String * nextInstruction;
         for (int32 i=0; msg()->FindString(parentNodePath, i, nextInstruction) == B_NO_ERROR; i++)
         {
            const char * childName = strchr(nextInstruction->Cstr(), ':');
            if (childName) childName++;  // child node name starts after the colon

            const int indexPos = atoi(nextInstruction->Cstr()+1);
            switch(nextInstruction()->Cstr()[0])
            {
               case INDEX_OP_CLEARED:  // a.k.a 'c'
                  (void) indices.Remove(parentNodePath);
               break;

               case INDEX_OP_ENTRYINSERTED:   // a.k.a 'i'
               {
                  Queue<String> * idx = indices.GetOrPut(parentNodePath);
                  if (idx) (void) idx->InsertItemAt(pos, childName);
               }
               break;
 
               case INDEX_OP_ENTRYREMOVED:   // a.k.a 'r'
               {
                  Queue<String> * idx = indices.GetOrPut(parentNodePath);
                  if ((idx)&&(idx->RemoveItemAt(pos) == B_NO_ERROR)&&(idx->IsEmpty()))
                  {
                     (void) indices.Remove(parentNodePath);
                  }
               }
               break;
            } 
         }
      }
   }

Quick links to source code of relevant MUSCLE-by-example programs: