@@ -65,11 +65,11 @@ function Base.bind(t::Trajectory{<:Any,<:Any,<:AsyncInsertSampleRatioController}
6565 bind (t. controler. ch_out, task)
6666end
6767
68+ # !!! by default we assume `x` is a complete example which contains all the traces
69+ # When doing partial inserting, the result of undefined
6870function Base. push! (t:: Trajectory , x)
69- n_pre = length (t. container)
7071 push! (t. container, x)
71- n_post = length (t. container)
72- on_insert! (t. controller, n_post - n_pre)
72+ on_insert! (t. controller, 1 )
7373end
7474
7575struct CallMsg
8181Base. push! (t:: Trajectory{<:Any,<:Any,<:AsyncInsertSampleRatioController} , args... ; kw... ) = put! (t. controller. ch_in, CallMsg (Base. push!, args, kw))
8282Base. append! (t:: Trajectory{<:Any,<:Any,<:AsyncInsertSampleRatioController} , args... ; kw... ) = put! (t. controller. ch_in, CallMsg (Base. append!, args, kw))
8383
84- function Base. append! (t:: Trajectory , x)
85- n_pre = length (t. container)
84+ function Base. append! (t:: Trajectory , x:: AbstractVector )
8685 append! (t. container, x)
87- n_post = length (t. container)
88- on_insert! (t. controller, n_post - n_pre)
86+ on_insert! (t. controller, length (x))
8987end
9088
89+ # !!! bypass the controller
90+ sample (t:: Trajectory ) = sample (t. sampler, t. container)
91+
9192function Base. take! (t:: Trajectory )
9293 res = on_sample! (t. controller)
9394 if isnothing (res)
0 commit comments