Skip to content

Conversation

@bernardnormier
Copy link
Member

Fixes #308.

{
Debug.Assert(node is not null); // The node proxies returned by list() are never null.

// TODO: should be an async call
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should generate a checkedCastAsync ... anything else would be inconsistent.

Copy link
Member

@pepone pepone Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding checkedCastAsync sounds good. On a side note the Slice model for this example isn't great.

I wondering if we should add a NodeInfo struct and NodeKind enum:

enum NodeKind
{
   File,
   Directory
}

struct NodeInfo
{
    string name;
    NodeKind kind;
    Node* node;
}

sequence<NodeInfo> NodeInfoSeq;

interface Directory extends Node
{
    idempotent NodeInfoSeq list();
}

This avoids the need for separate name, checkedCast requests.

{
Debug.Assert(node is not null); // The node proxies returned by list() are never null.

// TODO: should be an async call
Copy link
Member

@pepone pepone Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding checkedCastAsync sounds good. On a side note the Slice model for this example isn't great.

I wondering if we should add a NodeInfo struct and NodeKind enum:

enum NodeKind
{
   File,
   Directory
}

struct NodeInfo
{
    string name;
    NodeKind kind;
    Node* node;
}

sequence<NodeInfo> NodeInfoSeq;

interface Directory extends Node
{
    idempotent NodeInfoSeq list();
}

This avoids the need for separate name, checkedCast requests.

string kind = subdir is not null ? "directory" : "file";

Console.WriteLine($"{indent}{node.Name()} {kind}:");
Console.WriteLine($"{indent}{await node.NameAsync()} {kind}:");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a name variable here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This demo is really about the power of inheritance. And implementation reuse in C++. So I would not change the model or the checkedCast[Async].

@bernardnormier bernardnormier merged commit a68edfe into zeroc-ice:main Mar 3, 2025
8 checks passed
@bernardnormier bernardnormier deleted the async-fs branch June 18, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade Ice/Filesystem to use async invocations

3 participants