sdf-context-guest 0.11.0

guest crate for sdf operator ctx
Documentation
package sdf:context;

interface types {

    type window = tuple<timestamp, timestamp>;

    type timestamp = s64;

    record service-metadata {
        dataflow-name: string,
        service-name: string,
        states: list<tuple<string, state>>,
    }

    variant state {
        owned,
        ref(string)
    }

    record operator-metadata {
        service-metadata: service-metadata,
        operator-name: string
    }

    variant key {
        %string(string),
        %u64(u64),
        i64(s64),
        %bool(bool)
    } 
}

interface operator-context {
    use types.{ window as window-type, key as key-type, operator-metadata as operator-metadata-type };

    use sdf:df/lazy.{ df-value };
    use sdf:row-state/row.{ row-value };
    use sdf:value-state/values.{ value32, list32};

    // get window
    window: func() -> window-type;

    // get key
    key: func() -> option<key-type>;

    // service name
    operator-metadata: func() -> operator-metadata-type;
    
    // get row value for state name
    get-row-value: func(state-name: string) -> option<row-value>;

    // get value32
    get-value32: func(state-name: string) -> option<value32>;

    // get list32
    get-list32: func(state-name: string) -> option<list32>;

    // call sql
    sql: func(sql: string) -> result<df-value,string>;

}

world context-world {
    import operator-context;
}