MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / begin_pipeline

Function begin_pipeline

aiscript-vm/src/stdlib/db/redis.rs:198–216  ·  view source on GitHub ↗
(
        state: &mut State<'gc>,
        _args: Vec<Value<'gc>>,
    )

Source from the content-addressed store, hash-verified

196 }
197
198 pub(super) fn begin_pipeline<'gc>(
199 state: &mut State<'gc>,
200 _args: Vec<Value<'gc>>,
201 ) -> Result<Value<'gc>, VmError> {
202 let has_active = ACTIVE_PIPELINE.with(|tx| tx.borrow().is_some());
203 if has_active {
204 return Err(VmError::RuntimeError("Pipeline already active".into()));
205 }
206
207 // Create new pipeline
208 let pipeline = redis::pipe();
209 ACTIVE_PIPELINE.with(|cell| {
210 *cell.borrow_mut() = Some(pipeline);
211 });
212
213 let ctx = state.get_context();
214 let instance = Instance::new(create_pipeline_class(ctx));
215 Ok(Value::Instance(Gc::new(&ctx, RefLock::new(instance))))
216 }
217
218 fn cmd<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {
219 if args.is_empty() {

Callers

nothing calls this directly

Calls 6

RuntimeErrorClass · 0.85
create_pipeline_classFunction · 0.85
InstanceClass · 0.85
get_contextMethod · 0.80
borrowMethod · 0.45
borrow_mutMethod · 0.45

Tested by

no test coverage detected