Esempio n. 1
0
 internal CallPayload(PSharpRealProxy realProxy, ReplyTarget <TResult> replyTarget, MethodInfo method, object[] args)
 {
     this.realProxy   = realProxy;
     this.replyTarget = replyTarget;
     this.method      = method;
     this.args        = args;
 }
Esempio n. 2
0
        // Important: TIface must be an interface (or subclass of MarshalByRefObject).
        // This is easy to mess up if you allow it to be inferred.
        public static TIface MakeTransparentProxy <TIface>(MachineId callerMachineId, MachineId hostMachineId,
                                                           TIface target, string targetDebugName, EventFactory eventFactory)
        {
            // XXX: Verify up front that TIface is an interface with all methods acceptable?
            var realProxy = new PSharpRealProxy(typeof(TIface), callerMachineId, hostMachineId, target, targetDebugName, eventFactory);

            return((TIface)realProxy.GetTransparentProxy());
        }
Esempio n. 3
0
 internal ChainTable2PSharpProxy(MachineId callerMachineId, MachineId hostMachineId, IChainTable2 original)
 {
     this.callerMachineId    = callerMachineId;
     this.hostMachineId      = hostMachineId;
     nonannotatableCallProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                    null, () => new TableNonannotatableCallEvent());
     annotatableCallProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                 null, () => new TableAnnotatableCallEvent());
 }
Esempio n. 4
0
 internal ChainTable2PSharpProxy(MachineId callerMachineId, MachineId hostMachineId,
                                 IChainTable2 original, string debugName)
 {
     this.callerMachineId = callerMachineId;
     this.hostMachineId   = hostMachineId;
     this.debugName       = debugName;
     plainEventProxy      = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                 debugName, () => new GenericDispatchableEvent());
     tableCallEventProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                debugName, () => new TableCallEvent());
 }
Esempio n. 5
0
        public override async Task <IQueryStream <TElement> > ExecuteQueryStreamedAsync <TElement>(TableQuery <TElement> query, TableRequestOptions requestOptions = null, OperationContext operationContext = null)
        {
            // Philosophically, maybe this proxy-making belongs on the host
            // side, but that would require a second custom wrapper because we
            // still need the custom wrapper on the caller side to do the
            // different event types.
            IQueryStream <TElement> remoteStream = await nonannotatableCallProxy.ExecuteQueryStreamedAsync(
                query, requestOptions, operationContext);

            return(new QueryStreamPSharpProxy <TElement>(
                       PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, remoteStream,
                                                            null, () => new TableNonannotatableCallEvent())));
        }
Esempio n. 6
0
        public override async Task <IQueryStream <TElement> > ExecuteQueryStreamedAsync <TElement>(TableQuery <TElement> query, TableRequestOptions requestOptions = null, OperationContext operationContext = null)
        {
            //Trace.TraceInformation("{0} calling {1}.ExecuteQueryStreamedAsync({2})", callerMachineId, debugName, BetterComparer.ToString(query));
            // Philosophically, maybe this proxy-making belongs on the host
            // side, but that would require a second custom wrapper because we
            // still need the custom wrapper on the caller side to do the
            // different event types.
            IQueryStream <TElement> remoteStream = await plainEventProxy.ExecuteQueryStreamedAsync(
                query, requestOptions, operationContext);

            return(new QueryStreamPSharpProxy <TElement>(
                       PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, remoteStream,
                                                            string.Format("<{0} QueryStream>", debugName), () => new GenericDispatchableEvent())));
        }
Esempio n. 7
0
        internal ConfigurationServicePSharpProxy(MachineId callerMachineId, MachineId hostMachineId,
                                                 IConfigurationService <TConfig> original)
        {
            TConfig initialConfig;

            originalProxy = PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachineId, original,
                                                                 null, () => new GenericDispatchableEvent());

            IConfigurationSubscriber <TConfig> subscriberReverseProxy =
                PSharpRealProxy.MakeTransparentProxy(hostMachineId, callerMachineId,
                                                     (IConfigurationSubscriber <TConfig>) new Subscriber(this), null,
                                                     () => new GenericDispatchableEvent());

            // XXX Implement IDisposable.  Would need to proxy the dispose as well.
            original.Subscribe(subscriberReverseProxy, out initialConfig);

            mirror = new InMemoryConfigurationService <TConfig>(initialConfig);
        }
Esempio n. 8
0
 public static TIface MakeTransparentProxy <TIface>(this Machine hostMachine, TIface target,
                                                    string targetDebugName, MachineId callerMachineId, EventFactory eventFactory)
 {
     return(PSharpRealProxy.MakeTransparentProxy(callerMachineId, hostMachine.Id, target, targetDebugName, eventFactory));
 }
 internal Capturer(PSharpRealProxy outer, IMethodCallMessage callMsg)
 {
     this.outer   = outer;
     this.callMsg = callMsg;
 }