Пример #1
0
    public ComputeMethodInput(IFunction function, ComputeMethodDef method, AbstractInvocation invocation)
        : base(function)
    {
        Method               = method;
        Invocation           = invocation;
        NextInterceptorIndex = invocation.GetCurrentInterceptorIndex();

        var arguments        = invocation.Arguments;
        var argumentHandlers = method.ArgumentHandlers;
        var preprocessingArgumentHandlers = method.PreprocessingArgumentHandlers;

        if (preprocessingArgumentHandlers != null)
        {
            foreach (var(handler, index) in preprocessingArgumentHandlers)
            {
                handler.PreprocessFunc !.Invoke(method, invocation, index);
            }
        }

        var hashCode = System.HashCode.Combine(
            HashCode,
            method.InvocationTargetHandler.GetHashCodeFunc(invocation.InvocationTarget));

        for (var i = 0; i < arguments.Length; i++)
        {
            hashCode ^= argumentHandlers[i].GetHashCodeFunc(arguments[i]);
        }
        HashCode = hashCode;
    }
Пример #2
0
    protected override ComputeFunctionBase <T> CreateFunction <T>(ComputeMethodDef method)
    {
        var log = LoggerFactory.CreateLogger <ComputeMethodFunction <T> >();

        if (method.Options.IsAsyncComputed)
        {
            return(new AsyncComputeMethodFunction <T>(method, VersionGenerator, Services, log));
        }
        return(new ComputeMethodFunction <T>(method, VersionGenerator, Services, log));
    }
Пример #3
0
 protected ComputeMethodFunctionBase(
     ComputeMethodDef method,
     VersionGenerator <LTag> versionGenerator,
     IServiceProvider services,
     ILogger <ComputeMethodFunction <T> >?log = null)
     : base(method, services)
 {
     Log = log ?? NullLogger <ComputeMethodFunction <T> > .Instance;
     VersionGenerator = versionGenerator;
 }
Пример #4
0
 public ReplicaMethodFunction(
     ComputeMethodDef method,
     IReplicator replicator,
     VersionGenerator <LTag> versionGenerator,
     ILogger <ReplicaMethodFunction <T> >?log = null)
     : base(method, ((IReplicatorImpl)replicator).Services)
 {
     Log              = log ?? NullLogger <ReplicaMethodFunction <T> > .Instance;
     DebugLog         = Log.IsEnabled(LogLevel.Debug) ? Log : null;
     VersionGenerator = versionGenerator;
     Replicator       = replicator;
 }
Пример #5
0
 public ComputeMethodFunction(
     ComputeMethodDef method,
     VersionGenerator <LTag> versionGenerator,
     IServiceProvider services,
     ILogger <ComputeMethodFunction <T> >?log = null)
     : base(method, versionGenerator, services, log)
 {
     if (method.Options.IsAsyncComputed)
     {
         throw Errors.InternalError(
                   $"This type can't be used with {nameof(ComputedOptions)}.{nameof(ComputedOptions.IsAsyncComputed)} == true option.");
     }
 }
Пример #6
0
        protected override ComputeFunctionBase <T> CreateFunction <T>(ComputeMethodDef method)
        {
            var log = LoggerFactory.CreateLogger <ReplicaMethodFunction <T> >();

            return(new ReplicaMethodFunction <T>(method, Replicator, VersionGenerator, log));
        }
Пример #7
0
 protected abstract ComputeFunctionBase <T> CreateFunction <T>(ComputeMethodDef method);
Пример #8
0
 protected ComputeFunctionBase(ComputeMethodDef method, IServiceProvider services)
     : base(services)
 {
     Method  = method;
     Options = method.Options;
 }