Exemplo n.º 1
0
        private void InternalGetKnownTypes(IClient client)
        {
            try
            {
                var response = new ServerDescriptionResponse();


                foreach (var pair in _dataStores)
                {
                    response.AddTypeDescription(pair.Value.TypeDescription);

                    var dataStore = pair.Value;

                    var info = new DataStoreInfo
                    {
                        Count                     = dataStore.Count,
                        EvictionPolicy            = dataStore.EvictionType,
                        EvictionPolicyDescription =
                            dataStore.EvictionPolicy.ToString(),
                        FullTypeName  = dataStore.TypeDescription.FullTypeName,
                        AvailableData =
                            dataStore.DomainDescription ??
                            new DomainDescription(
                                dataStore.TypeDescription.FullTypeName),
                        DataCompression = dataStore.TypeDescription.UseCompression,

                        HitCount  = dataStore.HitCount,
                        ReadCount = dataStore.ReadCount
                    };

                    response.AddDataStoreInfo(info);
                }


                var currentProcess = Process.GetCurrentProcess();

                var assembly = Assembly.GetEntryAssembly();
                response.ServerProcessInfo = new ServerInfo
                {
                    ConnectedClients = (int)ActiveConnections,
                    StartTime        = StartTime,
                    Bits             = IntPtr.Size * 8,
                    Threads          = currentProcess.Threads.Count,
                    WorkingSet       = currentProcess.WorkingSet64,
                    VirtualMemory    = currentProcess.VirtualMemorySize64,
                    SoftwareVersion  =
                        assembly != null
                            ? assembly.GetName().Version.ToString()
                            : ""
                };


                client.SendResponse(response);
            }
            catch (Exception ex)
            {
                client.SendResponse(new ExceptionResponse(ex));
            }
        }
Exemplo n.º 2
0
        private void GetKnownTypes(IClient client)
        {
            try
            {
                var response = new ServerDescriptionResponse();

                var stores = DataStores.Values;



                foreach (var store in stores)
                {
                    response.AddTypeDescription(store.CollectionSchema);


                    var info = new DataStoreInfo
                    {
                        Count                     = store.DataByPrimaryKey.Count,
                        EvictionPolicy            = store.EvictionType,
                        EvictionPolicyDescription =
                            store.EvictionPolicy.ToString(),
                        FullTypeName  = store.CollectionSchema.CollectionName,
                        AvailableData =
                            store.DomainDescription ??
                            new DomainDescription(null),
                        DataCompression = store.CollectionSchema.UseCompression,

                        HitCount  = store.HitCount,
                        ReadCount = store.ReadCount
                    };

                    response.AddDataStoreInfo(info);
                }


                // add the special @ACTIVITY table (it may not be initialized in test environments)
                if (_serviceContainer.Log != null)
                {
                    var activityInfo = new DataStoreInfo
                    {
                        FullTypeName = LogEntry.Table,
                        Count        = _serviceContainer.Log.ActivityTable.DataByPrimaryKey.Count
                    };

                    response.AddDataStoreInfo(activityInfo);

                    response.AddTypeDescription(_serviceContainer.Log.ActivityTable.CollectionSchema);
                }


                var currentProcess = Process.GetCurrentProcess();

                var assembly = Assembly.GetAssembly(typeof(Server));
                response.ServerProcessInfo = new ServerInfo
                {
                    ConnectedClients = (int)ActiveConnections,
                    StartTime        = StartTime,
                    Bits             = IntPtr.Size * 8,
                    Threads          = currentProcess.Threads.Count,
                    WorkingSet       = currentProcess.WorkingSet64,
                    VirtualMemory    = currentProcess.VirtualMemorySize64,
                    SoftwareVersion  =
                        assembly != null
                            ? assembly.GetName().Version.ToString()
                            : ""
                };


                client.SendResponse(response);
            }
            catch (Exception ex)
            {
                client.SendResponse(new ExceptionResponse(ex));
            }
        }