[interfacekit] Re: PortLink(NG)

An update:

I have made all the changes to the interface kit (on my local HDD) to use the 
new PortLink.

PortMessage is no longer needed in the IK, but will be used in the appserver 
because it wants to
detach incoming messages with PortQueue instead of letting them sit in the 
shared-memory port
queue. 

BPrivate::BAppServerLink (which inherited from PortLink) is still there. The 
FlushWithReply()
convenience function which encapsulates some specific reply protocol for 
AppServer <-> IK is moved
to BAppServerLink instead of being in PortLink.

The arrangement is more efficient because before you created a PortLink 
(BAppServerLink) and a
PortMessage on the stack to send an opcode and get a quick reply, then you 
delete both. Now you
only need PortLink. Also with the new PortLink no buffer is allocated if no 
reply is sought, so it
is just as efficient as the old PortLink eventhough it is now read/write.

PortLink also replaces BSession. They both share the same protocol. The basic 
difference between
the PORTLINK and SESSION protocols was just that SESSION allowed multiple 
messages to be packed
into one port_write(). PORTLINK is just a special case of SESSION where only 
one message is
packed. The new PortLink just hides this variation. BAppServerLink can just 
inherit from PortLink
without knowing this.

There were hundreds of small changes, but basically it is the same as before. 
SetOpCode() becomes
StartMessage(). You don't need to call EndMessage() it is optional. It is 
automatically called
when you do StartMessage() for a new message, Flush(), or FlushWithReply(). The 
keeps the
messaging code compact. The PortLink::Attach<Type>(data) style is used over the
BSession::WriteInt32(data) style.

BPrivate::BAppServerLink link;
PortMessage msg;
msg.SetCode(SERVER_FALSE);
link.SetOpCode(AS_GET_MY_LUNCH);
link.FlushWithReply(&msg);
if (msg.Code() == SERVER_TRUE)
   msg.Read<int32>( &our_int);

becomes:

BPrivate::BAppServerLink link;
int32 code = SERVER_FALSE;
link.FlushWithReply(&code);
if (code == SERVER_TRUE)
   link.Read<int32>( &our_int );

And...

session->WriteInt32(AS_GET_MY_DINNER);
session->Sync();
session->ReadInt32(&code);
session->ReadInt8(&ch);

becomes:

fLink->StartMessage(AS_GET_MY_DINNER);
fLink->Flush();
fLink->GetNextReply(&code);
fLink->Read<int8>(&ch);

These files have been changed in the IK:

headers/private/app/PortLink.h
headers/private/app/PortMessage.h
headers/private/app/PortQueue.h
headers/private/app/AppServerLink.h
headers/os/interface/Window.h
kits/app/PortLink.cpp
kits/app/PortMessage.cpp
kits/app/PortQueue.cpp
kits/app/Application.cpp
kits/app/AppServerLink.cpp
kits/interface/Bitmap.cpp
kits/interface/Window.cpp
kits/interface/View.cpp
kits/interface/ClientFontList.cpp
kits/interface/Picture.cpp
kits/interface/Globals.cpp

The majority of the changes are going to be necessary even if we don't merge 
BSession and PortLink
since the CVS BSession needed to change anyway.

There are again a bunch of changes for the appserver. I would not wish it on 
DW, so I will do it.

Now all I need is the green-light to go ahead with it. It's a bottle neck and 
we all want to get
on with making the appserver do something we can take a screenshot of don't we?

Cheers,
Paul.



        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

Other related posts: