Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Explorer -- Added Grpc Server #182

Merged
merged 14 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Morgan Stanley makes this available to you under the Apache License,
// Version 2.0 (the "License"). You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0.
//
// See the NOTICE file distributed with this work for additional information
// regarding copyright ownership. Unless required by applicable law or agreed
// to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

namespace LocalCollector.Extensions;

internal static class HelperExtensionMethods
{
public static int IndexOf<T>(this IEnumerable<T> source, T value, IEqualityComparer<T>? comparer = null)
{
comparer ??= EqualityComparer<T>.Default;

var index = source
.Select((scopeValue, indexOf) => new { value = scopeValue, indexOf })
.FirstOrDefault(nextValue => comparer.Equals(nextValue.value, value));

return index?.indexOf ?? -1;
}

public static IEnumerable<T> Replace<T>(this IEnumerable<T> enumerable, int index, T value)
{
return enumerable.Select((x, i) => index == i ? value : x);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,16 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

using LocalCollector.Connections;
using LocalCollector.EnvironmentVariables;
using LocalCollector.Modules;
using LocalCollector.Registrations;
using ProcessExplorer.Abstractions.Entities;
using ProcessExplorer.Abstractions.Entities.Connections;
using ProcessExplorer.Abstractions.Infrastructure;

namespace LocalCollector;

public interface IProcessInfoCollector
{
/// <summary>
/// Contains information of the environment variables, connections, registrations, modules
/// </summary>
ProcessInfoCollectorData ProcessInformation { get; }

/// <summary>
/// Adds a list of connections to the existing one.
/// </summary>
Expand Down Expand Up @@ -63,7 +56,7 @@ public interface IProcessInfoCollector
Task AddModules(ModuleMonitorInfo modules);

/// <summary>
/// Adds information of conenctions/environment variables/registrations/modules to the colelction.
/// Adds information of connections/environment variables/registrations/modules to the colelction.
/// </summary>
/// <param name="connections"></param>
/// <param name="environmentVariables"></param>
Expand All @@ -73,12 +66,6 @@ public interface IProcessInfoCollector
Task AddRuntimeInformation(IConnectionMonitor connections, EnvironmentMonitorInfo environmentVariables,
RegistrationMonitorInfo registrations, ModuleMonitorInfo modules);

/// <summary>
/// Sets communicator, which talks with the Process Explorer backend. Also after the connection initialized it will send the data of the existing collections.
/// </summary>
/// <param name="communicator"></param>
void SetCommunicator(ICommunicator communicator);

/// <summary>
/// Sends the runtime information of the current process.
/// </summary>
Expand Down
Loading