11namespace Propulsion
22
3- open System.Runtime .InteropServices
43open Propulsion.Internal
4+ open System.Runtime .InteropServices
55
66type StreamFilter ([< Optional > ] allowCats , [< Optional > ] denyCats , [< Optional > ] allowSns , [< Optional > ] denySns ,
77 [<Optional>] allowEts, [<Optional>] denyEts,
8- [<Optional; DefaultParameterValue( false ) >] ?incIndexes ,
8+ [<Optional; DefaultParameterValue( false ) >] ?includeSystem ,
99 [<Optional; DefaultParameterValue( null ) >] ?log) =
1010 let log = lazy defaultArg log Serilog.Log.Logger
1111 let defA x = match x with null -> Array.empty | xs -> Seq.toArray xs
1212
13- let allowCats , denyCats , incIndexes = defA allowCats, defA denyCats, defaultArg incIndexes false
13+ let allowCats , denyCats , includeSystem_ = defA allowCats, defA denyCats, defaultArg includeSystem false
1414 let allowSns , denySns = defA allowSns, defA denySns
1515 let allowEts , denyEts = defA allowEts, defA denyEts
1616 let isPlain = Seq.forall ( fun x -> System.Char.IsLetterOrDigit x || x = '_' )
@@ -27,19 +27,20 @@ type StreamFilter([<Optional>] allowCats, [<Optional>] denyCats, [<Optional>] al
2727 let validStream = filter FsCodec.StreamName.toString ( allowSns, denySns)
2828 let isTransactionalStream ( sn : FsCodec.StreamName ) = let sn = FsCodec.StreamName.toString sn in not ( sn.StartsWith( '$' ))
2929
30- member _.CreateStreamFilter ( [<Optional>] maybeCategories ) =
30+ member _.CreateStreamFilter ( [<Optional>] maybeCategories , [<Optional>] ? includeSystem ) =
31+ let includeSystem = includeSystem_ || defaultArg includeSystem false
3132 let handlerCats = defA maybeCategories
3233 let allowCats = Array.append handlerCats allowCats
3334 let validCat = filter FsCodec.StreamName.Category.ofStreamName ( allowCats, denyCats)
3435 let allowCats = match allowCats with [||] -> [| " .*" |] | xs -> xs
35- let denyCats = if incIndexes then denyCats else Array.append denyCats [| " ^\$ " |]
36+ let denyCats = if includeSystem _ then denyCats else Array.append denyCats [| " ^\$ " |]
3637 let allowSns , denySns = match allowSns, denySns with [||], [||] -> [| " .*" |], [||] | x -> x
3738 let allowEts , denyEts = match allowEts, denyEts with [||], [||] -> [| " .*" |], [||] | x -> x
3839 log.Value.Information( " Categories ☑️ {@allowCats} 🚫{@denyCats} Streams ☑️ {@allowStreams} 🚫{denyStreams} Events ☑️ {allowEts} 🚫{@denyEts}" ,
3940 asRe allowCats, asRe denyCats, asRe allowSns, asRe denySns, asRe allowEts, asRe denyEts)
4041 fun sn ->
4142 validCat sn
4243 && validStream sn
43- && ( incIndexes || isTransactionalStream sn)
44+ && ( includeSystem || isTransactionalStream sn)
4445
4546 member val EventFilter = filter ( fun ( x : Propulsion.Sinks.Event ) -> x.EventType) ( allowEts, denyEts)
0 commit comments