Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4CA1818454 for ; Mon, 21 Sep 2015 14:26:59 +0000 (UTC) Received: (qmail 62822 invoked by uid 500); 21 Sep 2015 14:26:59 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 62751 invoked by uid 500); 21 Sep 2015 14:26:59 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 61829 invoked by uid 99); 21 Sep 2015 14:26:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Sep 2015 14:26:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1FB23E04D8; Mon, 21 Sep 2015 14:26:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Mon, 21 Sep 2015 14:27:16 -0000 Message-Id: <4b31f783ead14238a8a73f43fc21fe35@git.apache.org> In-Reply-To: <93d26f1773af4c11ad83de1f4f477c7a@git.apache.org> References: <93d26f1773af4c11ad83de1f4f477c7a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [20/52] [partial] ignite git commit: IGNITE-1513: Moved .Net. http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs deleted file mode 100644 index c124f84..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - using System; - using System.Collections.Generic; - using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Common; - - /// - /// Defines Ignite functionality for executing tasks and closures over nodes - /// in the . Instance of - /// is obtained from grid projection using method. - /// - /// Note that if attempt is made to execute a computation over an empty projection (i.e. projection that does - /// not have any alive nodes), ClusterGroupEmptyException will be thrown out of result future. - /// - /// Ignite must select a node for a computation to be executed. The node will be selected based on the - /// underlying GridLoadBalancingSpi, which by default sequentially picks next available node from - /// grid projection. Other load balancing policies, such as random or adaptive, can be - /// configured as well by selecting different load balancing SPI in Ignite configuration. If your logic requires - /// some custom load balancing behavior, consider implementing ComputeTask in Java directly. - /// - /// Ignite guarantees that as long as there is at least one Ignite node standing, every job will be - /// executed. Jobs will automatically failover to another node if a remote node crashed or has rejected - /// execution due to lack of resources. By default, in case of failover, next load balanced node will be - /// picked for job execution. Also jobs will never be re-routed to the nodes they have failed on. This - /// behavior can be changed by configuring any of the existing or a custom FailoverSpi in Ignite - /// configuration. - /// - /// All members are thread-safe and may be used concurrently from multiple threads. - /// - public interface ICompute : IAsyncSupport - { - /// - /// Grid projection to which this compute instance belongs. - /// - IClusterGroup ClusterGroup { get; } - - /// - /// Sets no-failover flag for the next executed task on this projection in the current thread. - /// If flag is set, job will be never failed over even if remote node crashes or rejects execution. - /// When task starts execution, the no-failover flag is reset, so all other task will use default - /// failover policy, unless this flag is set again. - /// - /// This compute instance for chaining calls. - ICompute WithNoFailover(); - - /// - /// Sets task timeout for the next executed task on this projection in the current thread. - /// When task starts execution, the timeout is reset, so one timeout is used only once. - /// - /// Computation timeout in milliseconds. - /// This compute instance for chaining calls. - ICompute WithTimeout(long timeout); - - /// - /// Sets keep-portable flag for the next executed Java task on this projection in the current - /// thread so that task argument passed to Java and returned task results will not be - /// deserialized. - /// - /// This compute instance for chaining calls. - ICompute WithKeepPortable(); - - /// - /// Executes given Java task on the grid projection. If task for given name has not been deployed yet, - /// then 'taskName' will be used as task class name to auto-deploy the task. - /// - /// Java task name - /// Optional argument of task execution, can be null. - /// Task result. - /// Type of task result. - T ExecuteJavaTask(string taskName, object taskArg); - - /// - /// Executes given task on the grid projection. For step-by-step explanation of task execution process - /// refer to documentation. - /// - /// Task to execute. - /// Optional task argument. - /// Task result. - /// Argument type. - /// Type of job result. - /// Type of reduce result. - [AsyncSupported] - TR Execute(IComputeTask task, TA taskArg); - - /// - /// Executes given task on the grid projection. For step-by-step explanation of task execution process - /// refer to documentation. - /// - /// Task to execute. - /// Task result. - /// Type of job result. - /// Type of reduce result. - [AsyncSupported] - TR Execute(IComputeTask task); - - /// - /// Executes given task on the grid projection. For step-by-step explanation of task execution process - /// refer to documentation. - /// - /// Task type. - /// Optional task argument. - /// Task result. - /// Argument type. - /// Type of job result. - /// Type of reduce result. - [AsyncSupported] - TR Execute(Type taskType, TA taskArg); - - /// - /// Executes given task on the grid projection. For step-by-step explanation of task execution process - /// refer to documentation. - /// - /// Task type. - /// Task result. - /// Type of job result. - /// Type of reduce result. - [AsyncSupported] - TR Execute(Type taskType); - - /// - /// Executes provided job on a node in this grid projection. The result of the - /// job execution is returned from the result closure. - /// - /// Job to execute. - /// Job result for this execution. - /// Type of job result. - [AsyncSupported] - TR Call(IComputeFunc clo); - - /// - /// Executes given job on the node where data for provided affinity key is located - /// (a.k.a. affinity co-location). - /// - /// Name of the cache to use for affinity co-location. - /// Affinity key. - /// Job to execute. - /// Job result for this execution. - /// Type of job result. - [AsyncSupported] - TR AffinityCall(string cacheName, object affinityKey, IComputeFunc clo); - - /// - /// Executes collection of jobs on nodes within this grid projection. - /// - /// Collection of jobs to execute. - /// Reducer to reduce all job results into one individual return value. - /// Reduced job result for this execution. - /// Type of job result. - /// Type of reduced result. - [AsyncSupported] - TR2 Call(IEnumerable> clos, IComputeReducer rdc); - - /// - /// Executes collection of jobs on nodes within this grid projection. - /// - /// Collection of jobs to execute. - /// Collection of job results for this execution. - /// Type of job result. - [AsyncSupported] - ICollection Call(IEnumerable> clos); - - /// - /// Broadcasts given job to all nodes in grid projection. Every participating node will return a job result. - /// - /// Job to broadcast to all projection nodes. - /// Collection of results for this execution. - [AsyncSupported] - ICollection Broadcast(IComputeFunc clo); - - /// - /// Broadcasts given closure job with passed in argument to all nodes in grid projection. - /// Every participating node will return a job result. - /// - /// Job to broadcast to all projection nodes. - /// Job closure argument. - /// Collection of results for this execution. - /// Type of argument. - /// Type of job result. - [AsyncSupported] - ICollection Broadcast(IComputeFunc clo, T arg); - - /// - /// Broadcasts given job to all nodes in grid projection. - /// - /// Job to broadcast to all projection nodes. - [AsyncSupported] - void Broadcast(IComputeAction action); - - /// - /// Executes provided job on a node in this grid projection. - /// - /// Job to execute. - [AsyncSupported] - void Run(IComputeAction action); - - /// - /// Executes given job on the node where data for provided affinity key is located - /// (a.k.a. affinity co-location). - /// - /// Name of the cache to use for affinity co-location. - /// Affinity key. - /// Job to execute. - [AsyncSupported] - void AffinityRun(string cacheName, object affinityKey, IComputeAction action); - - /// - /// Executes collection of jobs on Ignite nodes within this grid projection. - /// - /// Jobs to execute. - [AsyncSupported] - void Run(IEnumerable actions); - - /// - /// Executes provided closure job on a node in this grid projection. - /// - /// Job to run. - /// Job argument. - /// Job result for this execution. - /// Type of argument. - /// Type of job result. - [AsyncSupported] - TR Apply(IComputeFunc clo, T arg); - - /// - /// Executes provided closure job on nodes within this grid projection. A new job is executed for - /// every argument in the passed in collection. The number of actual job executions will be - /// equal to size of the job arguments collection. - /// - /// Job to run. - /// Job arguments. - /// Сollection of job results. - /// Type of argument. - /// Type of job result. - [AsyncSupported] - ICollection Apply(IComputeFunc clo, IEnumerable args); - - /// - /// Executes provided closure job on nodes within this grid projection. A new job is executed for - /// every argument in the passed in collection. The number of actual job executions will be - /// equal to size of the job arguments collection. The returned job results will be reduced - /// into an individual result by provided reducer. - /// - /// Job to run. - /// Job arguments. - /// Reducer to reduce all job results into one individual return value. - /// Reduced job result for this execution. - /// Type of argument. - /// Type of job result. - /// Type of reduced result. - [AsyncSupported] - TR2 Apply(IComputeFunc clo, IEnumerable args, IComputeReducer rdc); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs deleted file mode 100644 index 4a43f11..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - /// - /// Defines function having a single argument. - /// - public interface IComputeFunc - { - /// - /// Invoke function. - /// - /// Argument. - /// Result. - TR Invoke(T arg); - } - - /// - /// Defines function having no arguments. - /// - public interface IComputeFunc - { - /// - /// Invoke function. - /// - /// Result. - T Invoke(); - } - - /// - /// Defines a void function having no arguments. - /// - public interface IComputeAction - { - /// - /// Invokes action. - /// - void Invoke(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs deleted file mode 100644 index 3b8ac60..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - using System.Collections.Generic; - using Apache.Ignite.Core.Resource; - - /// - /// Defines executable unit for . Ignite task gets split into jobs - /// when method is called. This - /// method returns all jobs for the task mapped to their corresponding Ignite nodes for execution. - /// Grid will then serialize this jobs and send them to requested nodes for execution. - /// - /// Once job execution is complete, the return value will be sent back to parent task and will - /// be passed into - /// - /// method via instance. - /// - /// Ignite job implementation can be injected with using - /// attribute. - /// - public interface IComputeJob - { - /// - /// Executes this job. - /// - /// Job execution result (possibly null). This result will be returned - /// in object passed into - /// - /// on caller node. - T Execute(); - - /// - /// This method is called when system detects that completion of this - /// job can no longer alter the overall outcome (for example, when parent task - /// has already reduced the results). - /// - /// Note that job cancellation is only a hint, and it is really up to the actual job - /// instance to gracefully finish execution and exit. - /// - void Cancel(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs deleted file mode 100644 index 5891fd7..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - using System; - using System.Collections.Generic; - - /// - /// Job execution result which gets passed to - /// - /// method. - /// - public interface IComputeJobResult - { - /// - /// Gets data returned by remote job if it didn't fail. This data is the - /// object returned from method. - /// - /// Note that if task is annotated with - /// attribute, then job results will not be cached and will be available only in - /// - /// method for every individual job, but not in - /// method. - /// - /// - /// Data returned by job. - T Data(); - - /// - /// Gets local instance of remote job produced this result. - /// - /// - IComputeJob Job(); - - /// - /// Gets exception produced by execution of remote job, or null if no - /// exception was produced. - /// - /// Exception or null in case of success. - Exception Exception(); - - /// - /// ID of the node where actual job execution occurred. - /// - Guid NodeId - { - get; - } - - /// - /// Whether the job was cancelled. - /// - bool Cancelled - { - get; - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs deleted file mode 100644 index 46dcbd9..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - /// - /// Compute reducer which is capable of result collecting and reducing. - /// - public interface IComputeReducer - { - /// - /// Collect closure execution result. - /// - /// Result. - /// True to continue collecting results until all closures are finished, - /// false to start reducing. - bool Collect(TR1 res); - - /// - /// Reduce closure execution results collected earlier. - /// - /// Reduce result. - TR2 Reduce(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs deleted file mode 100644 index 21b6c48..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Compute -{ - using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; - using Apache.Ignite.Core.Cluster; - - /// - /// Ignite task interface defines a task that can be executed on the grid. Ignite task - /// is responsible for splitting business logic into multiple Ignite jobs, receiving - /// results from individual Ignite jobs executing on remote nodes, and reducing - /// (aggregating) received jobs' results into final Ignite task result. - /// - /// Upon request to execute a task, the system will do the following: - /// - /// - /// Inject annotated resources into task instance. - /// - /// - /// Apply . - /// This method is responsible for splitting business logic into multiple jobs - /// (units of execution) and mapping them to Ignite nodes. - /// - /// - /// System will send mapped Ignite jobs to their respective nodes. - /// - /// - /// Once job execution results become available method - /// - /// will be called for ech received job result. The policy returned by this method will - /// determine the way task reacts to every job result. - /// - /// If is returned, task will continue to wait - /// for other job results. If this result is the last job result, then reduce phase will be - /// started. - /// - /// If is returned, reduce phase will be started - /// right away without waiting for other jobs completion (all remaining jobs will receive cancel - /// request). - /// - /// If is returned, job will be failed over to - /// another node for execution. Note that if you use , it will - /// automatically fail jobs to another node for 2 well-known failure cases: 1) job has failed to due - /// to node crash (in this case will return - /// ); 2) job execution was rejected, i.e. remote node - /// has cancelled job before it got a chance to execute, while it still was on the waiting list. - /// (in this case will return - /// ). - /// - /// - /// - /// Once all results are received or - /// - /// method returned policy, method - /// - /// is called to aggregate received results into one final result. Once this method is finished the - /// execution of the Ignite task is complete. This result will be returned to the user through future. - /// - /// - /// - /// - /// Argument type. - /// Type of job result. - /// Type of reduce result. - public interface IComputeTask - { - /// - /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the - /// first method that gets called when task execution starts. - /// - /// Nodes available for this task execution. Note that order of nodes is - /// guaranteed to be randomized by container. This ensures that every time you simply iterate - /// through Ignite nodes, the order of nodes will be random which over time should result into - /// all nodes being used equally. - /// Task execution argument. Can be null. This is the same argument - /// as the one passed into ICompute.Execute() methods. - /// Map of Ignite jobs assigned to subgrid node. If null or empty map is returned, - /// exception will be thrown. - IDictionary, IClusterNode> Map(IList subgrid, TA arg); - - /// - /// Asynchronous callback invoked every time a result from remote execution is - /// received. It is ultimately upto this method to return a policy based - /// on which the system will either wait for more results, reduce results - /// received so far, or failover this job to another node. See - /// for more information. - /// - /// Received remote Ignite executable result. - /// All previously received results. Note that if task class has - /// attribute, then this list will be empty. - /// Result policy that dictates how to process further upcoming job results. - ComputeJobResultPolicy Result(IComputeJobResult res, IList> rcvd); - - /// - /// Reduces (or aggregates) results received so far into one compound result to be returned to - /// caller via future. - /// - /// Note, that if some jobs did not succeed and could not be failed over then the list of - /// results passed into this method will include the failed results. Otherwise, failed - /// results will not be in the list. - /// - /// Received job results. Note that if task class has - /// attribute, then this list will be empty. - /// Task result constructed from results of remote executions. - TR Reduce(IList> results); - } - - /// - /// IComputeTask without an argument. - /// - [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] - public interface IComputeTask : IComputeTask - { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs deleted file mode 100644 index 2713040..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Datastream -{ - using System; - using System.Collections.Generic; - using Apache.Ignite.Core.Cache.Store; - using Apache.Ignite.Core.Common; - - /// - /// Data streamer is responsible for loading external data into cache. It achieves it by - /// properly buffering updates and properly mapping keys to nodes responsible for the data - /// to make sure that there is the least amount of data movement possible and optimal - /// network and memory utilization. - /// - /// Note that streamer will load data concurrently by multiple internal threads, so the - /// data may get to remote nodes in different order from which it was added to - /// the streamer. - /// - /// Also note that IDataStreamer is not the only way to load data into cache. - /// Alternatively you can use - /// - /// method to load data from underlying data store. You can also use standard cache - /// put and putAll operations as well, but they most likely will not perform - /// as well as this class for loading data. And finally, data can be loaded from underlying - /// data store on demand, whenever it is accessed - for this no explicit data loading step - /// is needed. - /// - /// IDataStreamer supports the following configuration properties: - /// - /// - /// PerNodeBufferSize - /// When entries are added to data streamer they are not sent to Ignite - /// right away and are buffered internally for better performance and network utilization. - /// This setting controls the size of internal per-node buffer before buffered data is sent to - /// remote node. Default value is 1024. - /// - /// - /// PerNodeParallelOperations - /// Sometimes data may be added to the data streamer faster than it can be put - /// in cache. In this case, new buffered load messages are sent to remote nodes before - /// responses from previous ones are received. This could cause unlimited heap memory - /// utilization growth on local and remote nodes. To control memory utilization, this - /// setting limits maximum allowed number of parallel buffered load messages that are - /// being processed on remote nodes. If this number is exceeded, then data streamer add/remove - /// methods will block to control memory utilization. Default value is 16. - /// - /// - /// AutoFlushFrequency - /// Automatic flush frequency in milliseconds. Essentially, this is the time - /// after which the streamer will make an attempt to submit all data added so far to remote - /// nodes. Note that there is no guarantee that data will be delivered after this concrete - /// attempt (e.g., it can fail when topology is changing), but it won't be lost anyway. - /// Disabled by default (default value is 0). - /// - /// - /// Isolated - /// Defines if data streamer will assume that there are no other concurrent - /// updates and allow data streamer choose most optimal concurrent implementation. Default value - /// is false. - /// - /// - /// - /// All members are thread-safe and may be used concurrently from multiple threads. - /// - public interface IDataStreamer : IDisposable - { - /// - /// Name of the cache to load data to. - /// - string CacheName { get; } - - /// - /// Flag value indicating that this data streamer assumes that there could be concurrent updates to the cache. - /// - /// Default is false. - /// - bool AllowOverwrite { get; set; } - - /// - /// Flag indicating that write-through behavior should be disabled for data loading. - /// - /// Default is false. - /// - bool SkipStore { get; set; } - - /// - /// Size of per node key-value pairs buffer. - /// - /// Setter must be called before any add/remove operation. - /// - /// Default is 1024. - /// - int PerNodeBufferSize { get; set; } - - /// - /// Maximum number of parallel load operations for a single node. - /// - /// Setter must be called before any add/remove operation. - /// - /// Default is 16. - /// - int PerNodeParallelOperations { get; set; } - - /// - /// Automatic flush frequency in milliseconds. Essentially, this is the time after which the - /// streamer will make an attempt to submit all data added so far to remote nodes. - /// Note that there is no guarantee that data will be delivered after this concrete - /// attempt (e.g., it can fail when topology is changing), but it won't be lost anyway. - /// - /// If set to 0, automatic flush is disabled. - /// - /// Default is 0 (disabled). - /// - long AutoFlushFrequency { get; set; } - - /// - /// Gets future for this loading process. This future completes whenever method - /// completes. - /// - IFuture Future { get; } - - /// - /// Gets or sets custom stream receiver. - /// - IStreamReceiver Receiver { get; set; } - - /// - /// Adds single key-value pair for loading. Passing null as value will be - /// interpreted as removal. - /// - /// Key. - /// Value. - /// Future for this operation. - IFuture AddData(TK key, TV val); - - /// - /// Adds single key-value pair for loading. Passing null as pair's value will - /// be interpreted as removal. - /// - /// Key-value pair. - /// Future for this operation. - IFuture AddData(KeyValuePair pair); - - /// - /// Adds collection of key-value pairs for loading. - /// - /// Entries. - /// Future for this operation. - IFuture AddData(ICollection> entries); - - /// - /// Adds key for removal. - /// - /// Key. - /// Future for this operation. - IFuture RemoveData(TK key); - - /// - /// Makes an attempt to load remaining data. This method is mostly similar to - /// with the difference that it won't wait and - /// will exit immediately. - /// - void TryFlush(); - - /// - /// Loads any remaining data, but doesn't close the streamer. Data can be still added after - /// flush is finished. This method blocks and doesn't allow to add any data until all data - /// is loaded. - /// - void Flush(); - - /// - /// Closes this streamer optionally loading any remaining data. - /// - /// Whether to cancel ongoing loading operations. When set to true - /// there is not guarantees what data will be actually loaded to cache. - void Close(bool cancel); - - /// - /// Gets streamer instance with portable mode enabled, changing key and/or value types if necessary. - /// In portable mode stream receiver gets data in portable format. - /// You can only change key/value types when transitioning from non-portable to portable streamer; - /// Changing type of portable streamer is not allowed and will throw an - /// - /// Key type in portable mode. - /// Value type in protable mode. - /// Streamer instance with portable mode enabled. - IDataStreamer WithKeepPortable(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs deleted file mode 100644 index d75dc54..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Datastream -{ - using System.Collections.Generic; - using Apache.Ignite.Core.Cache; - - /// - /// Updates cache with batch of entries. - /// Usually it is enough to configure property and appropriate - /// internal cache receiver will be chosen automatically. But in some cases custom implementation may help - /// to achieve better performance. - /// - public interface IStreamReceiver - { - /// - /// Updates cache with batch of entries. - /// - /// Cache. - /// Entries. - void Receive(ICache cache, ICollection> entries); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs deleted file mode 100644 index 0398342..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Datastream -{ - using System.Collections.Generic; - using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.Impl.Datastream; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Portable; - - /// - /// Convenience adapter to transform update existing values in streaming cache - /// based on the previously cached value. - /// - /// Key type. - /// Value type. - /// The type of the processor argument. - /// The type of the processor result. - public sealed class StreamTransformer : IStreamReceiver, - IPortableWriteAware - { - /** Entry processor. */ - private readonly ICacheEntryProcessor _proc; - - /// - /// Initializes a new instance of the class. - /// - /// Entry processor. - public StreamTransformer(ICacheEntryProcessor proc) - { - IgniteArgumentCheck.NotNull(proc, "proc"); - - _proc = proc; - } - - /** */ - public void Receive(ICache cache, ICollection> entries) - { - var keys = new List(entries.Count); - - foreach (var entry in entries) - keys.Add(entry.Key); - - cache.InvokeAll(keys, _proc, default(TA)); - } - - /** */ - void IPortableWriteAware.WritePortable(IPortableWriter writer) - { - var w = (PortableWriterImpl)writer; - - w.WriteByte(StreamReceiverHolder.RcvTransformer); - - PortableUtils.WritePortableOrSerializable(w, _proc); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs deleted file mode 100644 index 5d155d7..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Datastream -{ - using System; - using System.Collections.Generic; - using Apache.Ignite.Core.Cache; - using Apache.Ignite.Core.Impl.Common; - - /// - /// Convenience adapter to visit every key-value tuple in the stream. - /// Note that the visitor does not update the cache. - /// - /// The type of the cache key. - /// The type of the cache value. - [Serializable] - public sealed class StreamVisitor : IStreamReceiver - { - /** Visitor action */ - private readonly Action, ICacheEntry> _action; - - /// - /// Initializes a new instance of the class. - /// - /// The action to be called on each stream entry. - public StreamVisitor(Action, ICacheEntry> action) - { - IgniteArgumentCheck.NotNull(action, "action"); - - _action = action; - } - - /** */ - public void Receive(ICache cache, ICollection> entries) - { - foreach (var entry in entries) - _action(cache, entry); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs deleted file mode 100644 index ff5084b..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System; - using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Portable; - - /// - /// In-memory database (cache) event. - /// - public sealed class CacheEvent : EventBase - { - /** */ - private readonly string _cacheName; - - /** */ - private readonly int _partition; - - /** */ - private readonly bool _isNear; - - /** */ - private readonly IClusterNode _eventNode; - - /** */ - private readonly object _key; - - /** */ - private readonly IgniteGuid _xid; - - /** */ - private readonly object _lockId; - - /** */ - private readonly object _newValue; - - /** */ - private readonly object _oldValue; - - /** */ - private readonly bool _hasOldValue; - - /** */ - private readonly bool _hasNewValue; - - /** */ - private readonly Guid _subjectId; - - /** */ - private readonly string _closureClassName; - - /** */ - private readonly string _taskName; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal CacheEvent(IPortableRawReader r) : base(r) - { - _cacheName = r.ReadString(); - _partition = r.ReadInt(); - _isNear = r.ReadBoolean(); - _eventNode = ReadNode(r); - _key = r.ReadObject(); - _xid = IgniteGuid.ReadPortable(r); - _lockId = r.ReadObject(); - _newValue = r.ReadObject(); - _oldValue = r.ReadObject(); - _hasOldValue = r.ReadBoolean(); - _hasNewValue = r.ReadBoolean(); - _subjectId = r.ReadGuid() ?? Guid.Empty; - _closureClassName = r.ReadString(); - _taskName = r.ReadString(); - } - - /// - /// Gets cache name. - /// - public string CacheName { get { return _cacheName; } } - - /// - /// Gets partition for the event which is the partition the key belongs to. - /// - public int Partition { get { return _partition; } } - - /// - /// Gets flag indicating whether event happened on near or partitioned cache. - /// - public bool IsNear { get { return _isNear; } } - - /// - /// Gets node which initiated cache operation or null if that node is not available. - /// - public IClusterNode EventNode { get { return _eventNode; } } - - /// - /// Gets cache entry associated with event. - /// - public object Key { get { return _key; } } - - /// - /// ID of surrounding cache cache transaction or null if there is no surrounding transaction. - /// - public IgniteGuid Xid { get { return _xid; } } - - /// - /// ID of the lock if held or null if no lock held. - /// - public object LockId { get { return _lockId; } } - - /// - /// Gets new value for this event. - /// - public object NewValue { get { return _newValue; } } - - /// - /// Gets old value associated with this event. - /// - public object OldValue { get { return _oldValue; } } - - /// - /// Gets flag indicating whether cache entry has old value in case if we only have old value in serialized form - /// in which case will return null. - /// - public bool HasOldValue { get { return _hasOldValue; } } - - /// - /// Gets flag indicating whether cache entry has new value in case if we only have new value in serialized form - /// in which case will return null. - /// - public bool HasNewValue { get { return _hasNewValue; } } - - /// - /// Gets security subject ID initiated this cache event, if available. This property is available only for , and cache events. Subject ID will be set either to nodeId initiated - /// cache update or read or client ID initiated cache update or read. - /// - public Guid SubjectId { get { return _subjectId; } } - - /// - /// Gets closure class name (applicable only for TRANSFORM operations). - /// - public string ClosureClassName { get { return _closureClassName; } } - - /// - /// Gets task name if cache event was caused by an operation initiated within task execution. - /// - public string TaskName { get { return _taskName; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: IsNear={1}, Key={2}, HasNewValue={3}, HasOldValue={4}, NodeId={5}", Name, - _isNear, _key, HasNewValue, HasOldValue, Node.Id); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs deleted file mode 100644 index 8443c68..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System; - using Apache.Ignite.Core.Portable; - - /// - /// Cache query execution event. - /// - public sealed class CacheQueryExecutedEvent : EventBase - { - /** */ - private readonly string _queryType; - - /** */ - private readonly string _cacheName; - - /** */ - private readonly string _className; - - /** */ - private readonly string _clause; - - /** */ - private readonly Guid _subjectId; - - /** */ - private readonly string _taskName; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal CacheQueryExecutedEvent(IPortableRawReader r) : base(r) - { - _queryType = r.ReadString(); - _cacheName = r.ReadString(); - _className = r.ReadString(); - _clause = r.ReadString(); - _subjectId = r.ReadGuid() ?? Guid.Empty; - _taskName = r.ReadString(); - } - - /// - /// Gets query type. - /// - public string QueryType { get { return _queryType; } } - - /// - /// Gets cache name on which query was executed. - /// - public string CacheName { get { return _cacheName; } } - - /// - /// Gets queried class name. Applicable for SQL and full text queries. - /// - public string ClassName { get { return _className; } } - - /// - /// Gets query clause. Applicable for SQL, SQL fields and full text queries. - /// - public string Clause { get { return _clause; } } - - /// - /// Gets security subject ID. - /// - public Guid SubjectId { get { return _subjectId; } } - - /// - /// Gets the name of the task that executed the query (if any). - /// - public string TaskName { get { return _taskName; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: QueryType={1}, CacheName={2}, ClassName={3}, Clause={4}, SubjectId={5}, " + - "TaskName={6}", Name, QueryType, CacheName, ClassName, Clause, SubjectId, TaskName); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs deleted file mode 100644 index 7338eab..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System; - using Apache.Ignite.Core.Portable; - - /// - /// Cache query read event. - /// - public sealed class CacheQueryReadEvent : EventBase - { - /** */ - private readonly string _queryType; - - /** */ - private readonly string _cacheName; - - /** */ - private readonly string _className; - - /** */ - private readonly string _clause; - - /** */ - private readonly Guid _subjectId; - - /** */ - private readonly string _taskName; - - /** */ - private readonly object _key; - - /** */ - private readonly object _value; - - /** */ - private readonly object _oldValue; - - /** */ - private readonly object _row; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal CacheQueryReadEvent(IPortableRawReader r) : base(r) - { - _queryType = r.ReadString(); - _cacheName = r.ReadString(); - _className = r.ReadString(); - _clause = r.ReadString(); - _subjectId = r.ReadGuid() ?? Guid.Empty; - _taskName = r.ReadString(); - _key = r.ReadObject(); - _value = r.ReadObject(); - _oldValue = r.ReadObject(); - _row = r.ReadObject(); - } - - /// - /// Gets query type. - /// - public string QueryType { get { return _queryType; } } - - /// - /// Gets cache name on which query was executed. - /// - public string CacheName { get { return _cacheName; } } - - /// - /// Gets queried class name. Applicable for SQL and full text queries. - /// - public string ClassName { get { return _className; } } - - /// - /// Gets query clause. Applicable for SQL, SQL fields and full text queries. - /// - public string Clause { get { return _clause; } } - - /// - /// Gets security subject ID. - /// - public Guid SubjectId { get { return _subjectId; } } - - /// - /// Gets the name of the task that executed the query (if any). - /// - public string TaskName { get { return _taskName; } } - - /// - /// Gets read entry key. - /// - public object Key { get { return _key; } } - - /// - /// Gets read entry value. - /// - public object Value { get { return _value; } } - - /// - /// Gets read entry old value (applicable for continuous queries). - /// - public object OldValue { get { return _oldValue; } } - - /// - /// Gets read results set row. - /// - public object Row { get { return _row; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: QueryType={1}, CacheName={2}, ClassName={3}, Clause={4}, SubjectId={5}, " + - "TaskName={6}, Key={7}, Value={8}, OldValue={9}, Row={10}", Name, QueryType, - CacheName, ClassName, Clause, SubjectId, TaskName, Key, Value, OldValue, Row); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs deleted file mode 100644 index 656550a..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Portable; - - /// - /// In-memory database (cache) rebalancing event. Rebalance event happens every time there is a change - /// - public sealed class CacheRebalancingEvent : EventBase - { - /** */ - private readonly string _cacheName; - - /** */ - private readonly int _partition; - - /** */ - private readonly IClusterNode _discoveryNode; - - /** */ - private readonly int _discoveryEventType; - - /** */ - private readonly string _discoveryEventName; - - /** */ - private readonly long _discoveryTimestamp; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal CacheRebalancingEvent(IPortableRawReader r) : base(r) - { - _cacheName = r.ReadString(); - _partition = r.ReadInt(); - _discoveryNode = ReadNode(r); - _discoveryEventType = r.ReadInt(); - _discoveryEventName = r.ReadString(); - _discoveryTimestamp = r.ReadLong(); - } - - /// - /// Gets cache name. - /// - public string CacheName { get { return _cacheName; } } - - /// - /// Gets partition for the event. - /// - public int Partition { get { return _partition; } } - - /// - /// Gets shadow of the node that triggered this rebalancing event. - /// - public IClusterNode DiscoveryNode { get { return _discoveryNode; } } - - /// - /// Gets type of discovery event that triggered this rebalancing event. - /// - public int DiscoveryEventType { get { return _discoveryEventType; } } - - /// - /// Gets name of discovery event that triggered this rebalancing event. - /// - public string DiscoveryEventName { get { return _discoveryEventName; } } - - /// - /// Gets timestamp of discovery event that caused this rebalancing event. - /// - public long DiscoveryTimestamp { get { return _discoveryTimestamp; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: CacheName={1}, Partition={2}, DiscoveryNode={3}, DiscoveryEventType={4}, " + - "DiscoveryEventName={5}, DiscoveryTimestamp={6}", Name, CacheName, Partition, - DiscoveryNode, DiscoveryEventType, DiscoveryEventName, DiscoveryTimestamp); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs deleted file mode 100644 index 7b7ea59..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using Apache.Ignite.Core.Portable; - - /// - /// Grid checkpoint event. - /// - public sealed class CheckpointEvent : EventBase - { - /** */ - private readonly string _key; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal CheckpointEvent(IPortableRawReader r) : base(r) - { - _key = r.ReadString(); - } - - /// - /// Gets checkpoint key associated with this event. - /// - public string Key { get { return _key; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: Key={1}", Name, Key); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs deleted file mode 100644 index 5b5443c..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System.Collections.Generic; - using System.Collections.ObjectModel; - using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Impl; - using Apache.Ignite.Core.Portable; - - /// - /// Grid discovery event. - /// - public sealed class DiscoveryEvent : EventBase - { - /** */ - private readonly IClusterNode _eventNode; - - /** */ - private readonly long _topologyVersion; - - /** */ - private readonly ReadOnlyCollection _topologyNodes; - - /// - /// Constructor. - /// - /// The reader to read data from. - internal DiscoveryEvent(IPortableRawReader r) : base(r) - { - _eventNode = ReadNode(r); - _topologyVersion = r.ReadLong(); - - var nodes = IgniteUtils.ReadNodes(r); - - _topologyNodes = nodes == null ? null : new ReadOnlyCollection(nodes); - } - - /// - /// Gets node that caused this event to be generated. It is potentially different from the node on which this - /// event was recorded. For example, node A locally recorded the event that a remote node B joined the topology. - /// In this case this method will return ID of B. - /// - public IClusterNode EventNode { get { return _eventNode; } } - - /// - /// Gets topology version if this event is raised on topology change and configured discovery - /// SPI implementation supports topology versioning. - /// - public long TopologyVersion { get { return _topologyVersion; } } - - /// - /// Gets topology nodes from topology snapshot. If SPI implementation does not support versioning, the best - /// effort snapshot will be captured. - /// - public ICollection TopologyNodes { get { return _topologyNodes; } } - - /** */ - public override string ToShortString() - { - return string.Format("{0}: EventNode={1}, TopologyVersion={2}, TopologyNodes={3}", Name, EventNode, - TopologyVersion, TopologyNodes.Count); - } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs deleted file mode 100644 index 2b905a1..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System; - using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Common; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Portable; - - /// - /// Base event implementation. - /// - public abstract class EventBase : IEvent, IEquatable - { - /** */ - private readonly IgniteGuid _id; - - /** */ - private readonly long _localOrder; - - /** */ - private readonly IClusterNode _node; - - /** */ - private readonly string _message; - - /** */ - private readonly int _type; - - /** */ - private readonly string _name; - - /** */ - private readonly DateTime _timeStamp; - - /// - /// Initializes a new instance of the class. - /// - /// The reader to read data from. - protected EventBase(IPortableRawReader r) - { - _id = IgniteGuid.ReadPortable(r); - - _localOrder = r.ReadLong(); - - _node = ReadNode(r); - - _message = r.ReadString(); - _type = r.ReadInt(); - _name = r.ReadString(); - _timeStamp = r.ReadDate() ?? DateTime.Now; - } - - /** */ - public IgniteGuid Id - { - get { return _id; } - } - - /** */ - public long LocalOrder - { - get { return _localOrder; } - } - - /** */ - public IClusterNode Node - { - get { return _node; } - } - - /** */ - public string Message - { - get { return _message; } - } - - /** */ - public int Type - { - get { return _type; } - } - - /** */ - public string Name - { - get { return _name; } - } - - /** */ - public DateTime TimeStamp - { - get { return _timeStamp; } - } - - /** */ - public virtual string ToShortString() - { - return ToString(); - } - - /** */ - public bool Equals(EventBase other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - - return _id.Equals(other._id); - } - - /** */ - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != GetType()) return false; - - return Equals((EventBase) obj); - } - - /** */ - public override int GetHashCode() - { - return _id.GetHashCode(); - } - - /** */ - public override string ToString() - { - return string.Format("CacheEntry [Name={0}, Type={1}, TimeStamp={2}, Message={3}]", Name, Type, TimeStamp, - Message); - } - - /// - /// Reads a node from stream. - /// - /// Reader. - /// Node or null. - protected static IClusterNode ReadNode(IPortableRawReader reader) - { - return ((PortableReaderImpl)reader).Marshaller.Ignite.GetNode(reader.ReadGuid()); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f2eb16cd/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs deleted file mode 100644 index aa9f538..0000000 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 Apache.Ignite.Core.Events -{ - using System; - using Apache.Ignite.Core.Portable; - - /// - /// Event reader. - /// - internal static class EventReader - { - /// - /// Reads an event. - /// - /// Type of the event - /// Reader. - /// Deserialized event. - /// Incompatible event type. - public static T Read(IPortableReader reader) where T : IEvent - { - var r = reader.RawReader(); - - var clsId = r.ReadInt(); - - if (clsId == -1) - return default(T); - - return (T) CreateInstance(clsId, r); - } - - /// - /// Creates an event instance by type id. - /// - /// Type id. - /// Reader. - /// Created and deserialized instance. - /// Invalid event class id: + clsId - private static IEvent CreateInstance(int clsId, IPortableRawReader reader) - { - switch (clsId) - { - case 2: return new CacheEvent(reader); - case 3: return new CacheQueryExecutedEvent(reader); - case 4: return new CacheQueryReadEvent(reader); - case 5: return new CacheRebalancingEvent(reader); - case 6: return new CheckpointEvent(reader); - case 7: return new DiscoveryEvent(reader); - case 8: return new JobEvent(reader); - case 9: return new SwapSpaceEvent(reader); - case 10: return new TaskEvent(reader); - } - - throw new InvalidOperationException("Invalid event class id: " + clsId); - } - } -} \ No newline at end of file