コード例 #1
0
ファイル: MarshallerChannel.cs プロジェクト: Azure/RingMaster
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxyWatcher"/> class.
 /// </summary>
 /// <param name="marshaller">The marshaller.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="kind">Kind of the watcher.</param>
 /// <param name="path">Path associated with the watcher</param>
 public ProxyWatcher(MarshallerChannel marshaller, ulong id, WatcherKind kind, string path)
 {
     this.marshaller = marshaller;
     this.Id         = id;
     this.Kind       = kind;
     this.Path       = path;
 }
コード例 #2
0
        /// <summary>
        /// Handles ringmaster requests.
        /// </summary>
        /// <param name="request">RingMaster request</param>
        /// <param name="onCompletion">Action to execute when the replication is completed</param>
        /// <remarks>
        /// Implementing the <see cref="IRingMasterRequestHandlerOverlapped"/> makes it possible for
        /// several libraries to work directly with the RingMasterBackendCore. This class
        /// is being implemented here to avoid having to expose internal classes outside of
        /// this library.
        /// </remarks>
        public void RequestOverlapped(IRingMasterRequest request, Action <RequestResponse, Exception> onCompletion)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            RequestCall call = MarshallerChannel.LocalRequest(request);

            call.CallId = (ulong)Interlocked.Increment(ref this.lastAssignedCallId);

            this.executor.ProcessMessage(
                call.Request,
                this.session,
                (response, ex) =>
            {
                response.CallId = call.CallId;
                onCompletion?.Invoke(response, ex);
            });
        }