Giter Club home page Giter Club logo

Comments (6)

qti3e avatar qti3e commented on June 15, 2024 1

Hey!

v0.5 is still alpha, we're pushing for it to be stable very soon, hopefully, this week. For the inter-canister calls, you can currently see the example in fib and multi-counter both demoing the use of the new CallBuilder

For automatic candid generation notice this in the fib example:

#[derive(KitCanister)]
#[candid_path("candid.did")]
pub struct FibCanister;

running cargo test now automatically writes the candid to the provided path.

As for importing canisters and dynamic creation, the new version is taking a different approach which is what's currently pending, the factory-counter example should demo this once it is possible.

from ic-kit.

qti3e avatar qti3e commented on June 15, 2024 1

see this #24 for the wip dynamic canister creation.

from ic-kit.

qti3e avatar qti3e commented on June 15, 2024 1

believe me, we're also eagerly awaiting the release internally xD

  1. the main.rs file is used for building the canister as a wasm, but we're considering allowing a CLI over the canister implementation, and later allowing cargo run to spin up a debugger replica, but i think if you do crate-type = ["cdylib", "lib"] you should be able to both import the library and build it at the same time. So there is a chance we may end up removing those main.rs files and have one bin/src/{cli.rs, replica.rs}
  2. for type-safe canister interface import we're also thinking of auto-generating a trait for the canister, the design of it is still pending, but once we merge the dynamic canister ability, we can move to that.

But one of our main goals is being able to import the canister, that is:

  1. import the canister along its dependencies for testing.
  2. import the canister for dynamic creation (factory design pattern)
  3. Import the interface of the canister to do type-safe interaction.

from ic-kit.

qti3e avatar qti3e commented on June 15, 2024 1

The upgrade and schema migration should happen on each canister level, we will only provide the installation helpers in the dynamic canister context.

But ic-kit-stable is probably what you would be interested in, it will contain stable data structures implemented. and as far as schema migration goes it's always advised to:

  1. never remove/rename a field at the application data model layer.
  2. always only append new optional fields in the model layer and provide a default value.

This will greatly reduce your cost of migration and more importantly will save you from headaches since you can still restore/decode data stored in a previous version and access it.

And as far as mass migration goes, we currently don't have something on the roadmap, but if it turns out to be a need for some project internally we may consider creating an option (Cap future migration might involve a mass migration, but I honestly don't know and wish it doesn't!)

from ic-kit.

saikatdas0790 avatar saikatdas0790 commented on June 15, 2024

@qti3e Thank you for the clarification. Eagerly awaiting the release :)

2 quick questions I had while going through the example code:

  • Any particular reason why there's a main.rs files for all the canister packages? Do you build a binary? What does it do?
  • The Dfinity prescribed mechanism of inter-canister calls just needs you to import the canister name and it detects the details (I imagine from the dfx.json and canister_ids.json files). The CallBuilder mechanism requires us to pass the canister_id as a Principal and the method name to be called as a String kinda how the ic_cdk does it as a System API call. I apologize if my Rust understanding is limited but I was wondering if there's a way to import the canister struct definition in a type safe way into another canister and have it expose its methods available in a type safe way. This would be the the most ergonomic and delightful developer experience possible and would make ic-kit a compelling reason for other projects as well as opposed to the ic_cdk. I imagine this is possible theoretically since the type information is available over Candid but not sure how feasible this is practically.

Thank you for the inputs nonetheless :)

from ic-kit.

saikatdas0790 avatar saikatdas0790 commented on June 15, 2024

@qti3e
One final question. For dynamically created canisters, how do you prescribe handling migrations, especially if there's a schema change? Will ic-kit have any guidelines/features around it?

from ic-kit.

Related Issues (4)

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.