示例#1
0
        public void Connect()
        {
            if (connected)
                throw new InvalidOperationException("The client is already connected.");

            storageSystem = new NetworkTreeSystem(connector, managerAddress, cache);
            storageSystem.SetMaxNodeCacheHeapSize(maxTransactionNodeCacheHeapSize);
            connected = true;
        }
示例#2
0
        public void ConnectNetwork()
        {
            if (IsConnected)
                throw new ApplicationException("Already connected");

            serviceTracker = new ServiceStatusTracker(connector);
            treeSystem = new NetworkTreeSystem(connector, managerAddresses, localNetworkCache, serviceTracker);
            treeSystem.NodeHeapMaxSize = MaxTransactionNodeCacheHeapSize;
            connected = true;
        }
示例#3
0
        public void Disconnect()
        {
            if (connector != null) {
                try {
                    connector.Close();
                } finally {
                    try {
                        serviceTracker.Stop();
                    } finally {
                        connector = null;
                        serviceTracker = null;
                        treeSystem = null;
                    }

                    connected = false;
                }
            }
        }
示例#4
0
        private void InitPath(PathInfo pathInfo)
        {
            IServiceAddress[] manSrvs = managerServers;

            // Fetch the path access object for the given name.
            PathAccess pathFile = GetPathAccess(pathInfo.PathName);

            IPath pathFunction;
            try {
                pathFunction = pathFile.Path;
            } catch (TypeLoadException e) {
                throw new CommitFaultException(String.Format("Type not found: {0}", e.Message));
            } catch (TypeInitializationException e) {
                throw new CommitFaultException(String.Format("Type instantiation exception: {0}", e.Message));
            } catch (AccessViolationException e) {
                throw new CommitFaultException(String.Format("Illegal Access exception: {0}", e.Message));
            }

            // Create the connection object (should be fairly lightweight)
            INetworkCache localNetCache = MachineState.GetCacheForManager(manSrvs);
            IPathConnection connection = new PathConnection(this, pathInfo, connector, manSrvs, localNetCache, serviceTracker);

            // Make an initial empty database for the path,
            // PENDING: We could keep a cached version of this image, but it's
            //   miniscule in size.
            NetworkTreeSystem treeSystem = new NetworkTreeSystem(connector, manSrvs, localNetCache, serviceTracker);
            treeSystem.NodeHeapMaxSize = 1*1024*1024;
            DataAddress emptyDbAddr = treeSystem.CreateDatabase();
            // Publish the empty state to the path,
            connection.Publish(emptyDbAddr);
            // Call the initialize function,
            pathFunction.Init(connection);
        }
示例#5
0
            public PathConnection(RootService service, PathInfo pathInfo, IServiceConnector connector, IServiceAddress[] managerServers,
			                      INetworkCache cache, ServiceStatusTracker statusTracker)
            {
                this.service = service;
                this.pathInfo = pathInfo;
                treeSystem = new NetworkTreeSystem(connector, managerServers, cache, statusTracker);
            }
示例#6
0
 public PathConnection(RootService service, string pathName, 
     IServiceConnector connector, IServiceAddress manager,
     INetworkCache networkCache)
 {
     this.service = service;
     this.pathName = pathName;
     treeSystem = new NetworkTreeSystem(connector, manager, networkCache);
 }
示例#7
0
 private void OnDisconnected()
 {
     connector = null;
     storageSystem = null;
 }