Exemple #1
0
        public override Func <Target, Equinox.Core.IStream <TEvent, TState> > Resolve <TEvent, TState>(
            FsCodec.IUnionEncoder <TEvent, byte[], object> codec,
            Func <TState, IEnumerable <TEvent>, TState> fold,
            TState initial,
            Func <TEvent, bool> isOrigin  = null,
            Func <TState, TEvent> compact = null)
        {
            var accessStrategy =
                isOrigin == null && compact == null
                    ? null
                    : AccessStrategy <TEvent, TState> .NewSnapshot(FuncConvert.FromFunc(isOrigin), FuncConvert.FromFunc(compact));

            var cacheStrategy = _cache == null
                ? null
                : CachingStrategy.NewSlidingWindow(_cache, TimeSpan.FromMinutes(20));
            var resolver = new Resolver <TEvent, TState, object>(_store, codec, FuncConvert.FromFunc(fold), initial, cacheStrategy, accessStrategy);

            return(t => resolver.Resolve(t));
        }
        public override Func <string, IStream <TEvent, TState> > Resolve <TEvent, TState>(
            FsCodec.IEventCodec <TEvent, byte[], object> codec,
            Func <TState, IEnumerable <TEvent>, TState> fold,
            TState initial,
            Func <TEvent, bool> isOrigin     = null,
            Func <TState, TEvent> toSnapshot = null)
        {
            var accessStrategy =
                isOrigin == null && toSnapshot == null
                    ? null
                    : AccessStrategy <TEvent, TState> .NewRollingSnapshots(FuncConvert.FromFunc(isOrigin), FuncConvert.FromFunc(toSnapshot));

            var cacheStrategy = _cache == null
                ? null
                : CachingStrategy.NewSlidingWindow(_cache, TimeSpan.FromMinutes(20));
            var cat = new EventStoreCategory <TEvent, TState, object>(_connection, codec, FuncConvert.FromFunc(fold),
                                                                      initial, cacheStrategy, accessStrategy);

            return(t => cat.Resolve(t));
        }
Exemple #3
0
        public override Func <Target, IStream <TEvent, TState> > Resolve <TEvent, TState>(
            IUnionEncoder <TEvent, byte[]> codec,
            Func <TState, IEnumerable <TEvent>, TState> fold,
            TState initial,
            Func <TEvent, bool> isOrigin  = null,
            Func <TState, TEvent> compact = null)
        {
            var accessStrategy =
                isOrigin == null && compact == null
                    ? null
                    : AccessStrategy <TEvent, TState> .NewRollingSnapshots(FuncConvert.FromFunc(isOrigin), FuncConvert.FromFunc(compact));

            var cacheStrategy = _cache == null
                ? null
                : CachingStrategy.NewSlidingWindow(_cache, TimeSpan.FromMinutes(20));
            var resolver = new GesResolver <TEvent, TState>(_gateway, codec, FuncConvert.FromFunc(fold),
                                                            initial, accessStrategy, cacheStrategy);

            return(t => resolver.Resolve.Invoke(t));
        }