Code Monkey home page Code Monkey logo

Comments (1)

lurenpluto avatar lurenpluto commented on June 18, 2024

1101829

  • GlobalStateManager has been refactored to support the creation of multiple global-states in parallel, for example, each group can be assigned a global-state

  • Added traits to use global-state for external components of cyfs-stack

GlobalStateRawProcessor
GlobalStateManagerRawProcessor

The sample code for using external components is as follows

async fn usage(state_manager: GlobalStateManagerRawProcessorRef) -> BuckyResult<()> {
    let isolate_id = ObjectId::default();
    let owner = Some(PeopleId::default().object_id().clone());
    let group_state = state_manager.load_root_state(&isolate_id, owner, true).await?.unwrap();

    // get dec's root, create if not exists
    let dec_id = cyfs_core::DecAppId::default();
    let dec_group_state = group_state.get_dec_root_manager(dec_id.object_id(), true).await?;

    let op_env = dec_group_state.create_op_env(None).unwrap();
    // do something with op_env
    op_env.commit().await.unwrap();

    Ok(())
}

from cyfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.