public void Set(String path, IServiceAddress rootAddress) { string rootAddrStr = null; if (rootAddress != null) rootAddrStr = rootAddress.ToString(); dictionary.SetValue(path, rootAddrStr); }
public void Set(String path, IServiceAddress rootAddress) { string rootAddrStr = null; if (rootAddress != null) { rootAddrStr = rootAddress.ToString(); } dictionary.SetValue(path, rootAddrStr); }
public string ToString(IServiceAddress address) { return(address.ToString()); }
public string ToString(IServiceAddress address) { return address.ToString(); }
private void RegisterBlockServer(IServiceAddress blockServerAddress) { // Get the block server uid, Message message = new Message("serverGUID"); // Connect to the block server, IMessageProcessor processor = connector.Connect(blockServerAddress, ServiceType.Block); IEnumerable<Message> response = processor.Process(message.AsStream()); Message rm = null; foreach (Message m in response) { if (m.HasError) throw new ApplicationException(m.ErrorMessage); rm = m; } long serverGuid = (long) rm.Arguments[0].Value; // Add lookup for this server_guid <-> service address to the db, managerDb.SetValue("block.sguid." + serverGuid, blockServerAddress.ToString()); managerDb.SetValue("block.addr." + blockServerAddress, serverGuid.ToString()); // TODO: Block discovery on the introduced machine, // Set the status and guid BlockServiceInfo blockServer = new BlockServiceInfo(serverGuid, blockServerAddress); // Add it to the map lock (blockServersMap) { blockServersMap[serverGuid] = blockServer; blockServersList.Add(blockServer); PersistBlockServers(blockServersList); } }
private Message ProcessSingleRoot(IEnumerable<Message> outputStream, IServiceAddress rootServer) { IMessageProcessor processor = connector.Connect(rootServer, ServiceType.Root); IEnumerable<Message> inputStream = processor.Process(outputStream); Message lastM = null; foreach (Message m in inputStream) { lastM = m; if (m.HasError) { // If it's a connection failure, inform the service tracker and throw // service not available exception. if (IsConnectionFailMessage(m)) { serviceTracker.ReportServiceDownClientReport(rootServer, ServiceType.Root); throw new ServiceNotConnectedException(rootServer.ToString()); } string errorSource = m.Error.Source; // Rethrow InvalidPathInfoException locally, if (errorSource.Equals("Deveel.Data.Net.InvalidPathInfoException")) { throw new InvalidPathInfoException(m.ErrorMessage); } } } return lastM; }
protected override void OnBindingWithManager(IServiceAddress managerAddress) { // Contains the root properties, string propFile = Path.Combine(basePath, "00.properties"); using(FileStream fileStream = new FileStream(propFile, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { // Write the manager server address to the properties file, Properties p = new Properties(); if (fileStream.Length > 0) p.Load(fileStream); p.SetProperty("manager_address", managerAddress.ToString()); fileStream.SetLength(0); p.Store(fileStream, null); fileStream.Close(); } }