80 likes | 175 Views
CAN Implementation Sub-project: Content Manager. Amol Bakshi abakshi@usc.edu CSCI 599 14 October 2002. Role of Content Manager in a CAN. All <key, value> pairs are ultimately stored in a database (such as Microsoft Access) Lookup, Add, and Delete operations access the “target” database
E N D
CAN Implementation Sub-project:Content Manager Amol Bakshi abakshi@usc.edu CSCI 599 14 October 2002
Role of Content Manager in a CAN • All <key, value> pairs are ultimately stored in a database (such as Microsoft Access) • Lookup, Add, and Delete operations access the “target” database • Content Manager (CM) is a wrapper around the database that executes the operations on the target node
CAN Implementation Proxy CLIENT Message Dispatcher next-node original Communication Engine Content Manager DB Routing Manager
CM Pseudo-code • Invoked by Message Dispatcher with message format • ProcessMsg(byte[] message){ • Check if current node is target node • If it is, access the node database • Perform add/delete/lookup operation on database • Via Comm.Engine, send the result of operation to originating proxy • If not, forward message as-is to routing manager }
Database Access in C#/.NET OleDbConnection cConn = new OleDbConnection(“Provider=Microsoft.Net.OLEDB.4.0;Data Source=c:\\can.mdb”); OleDbCommand cComm = new OleDbCommand(“Select * from can”, cConn); OleDbDataAdapter canDA = new OleDbDataAdapter(); canDA.SelectCommand = cComm; DataSet canDS = new DataSet(“CANdata”); canDA.Fill(canDS, “KeyValInfo”);
CM and Other CAN Components (1) • CM and Proxy • No direct interaction between CM and Proxy • CM of the target node will indirectly contact the originating Proxy with the result of the operation • IP addr and channel ID of Proxy encapsulated in the Message • CM and Comm. Engine (CE) • All communication routed through CE • CM invokes SendMsg of CE to contact original Proxy (described above)
CM and Other CAN Components (2) • CM and Message Dispatcher (MD) • CM provides ProcessMsg interface to MD • CM does not call any service of the MD • CM and Routing Manager (RM) • CM needs to know if the current node is the target node (esp. important for ‘add’ operation) • RM maintains virtual topology and maps to physical topology; hence can provide this information • CM invokes a TargetNode(key) function from RM with a boolean return value
Design Issue: Blocking or Non-Blocking? • Blocking calls within components • Easy to implement • Eventually terminate (at CommEngine?) • e.g. MD -> CM -> RM -> CE • Non-blocking calls • greater throughput • harder to implement • overload CE(?)