Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Ice/BuiltinSequences.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) ZeroC, Inc.
Copy link
Member Author

Choose a reason for hiding this comment

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

BuiltinSequences.ice etc are identical to the files in https://github.com/zeroc-ice/ice/tree/main/slice (main and 3.8), except for the addition of the #ifdef __ICERPC__ block.


#pragma once

[["cpp:dll-export:ICE_API"]]
[["cpp:doxygen:include:Ice/Ice.h"]]
[["cpp:header-ext:h"]]

[["cpp:no-default-include"]]
[["cpp:include:Ice/Config.h"]]
[["cpp:include:Ice/ObjectF.h"]]
[["cpp:include:Ice/ProxyF.h"]]
[["cpp:include:Ice/ValueF.h"]]
[["cpp:include:cstdint"]]
[["cpp:include:optional"]]
[["cpp:include:string"]]
[["cpp:include:vector"]]

[["js:module:@zeroc/ice"]]

#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
["java:identifier:com.zeroc.Ice"]
module Ice
{
/// A sequence of bools.
sequence<bool> BoolSeq;

/// A sequence of bytes.
sequence<byte> ByteSeq;

/// A sequence of shorts.
sequence<short> ShortSeq;

/// A sequence of ints.
sequence<int> IntSeq;

/// A sequence of longs.
sequence<long> LongSeq;

/// A sequence of floats.
sequence<float> FloatSeq;

/// A sequence of doubles.
sequence<double> DoubleSeq;

/// A sequence of strings.
sequence<string> StringSeq;

/// A sequence of class instances.
["deprecated:Define your own sequence instead and avoid using the term `object` to designate a class instance."]
sequence<Value> ObjectSeq;

/// A sequence of object proxies.
sequence<Object*> ObjectProxySeq;
}
39 changes: 39 additions & 0 deletions Ice/Identity.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) ZeroC, Inc.

#pragma once

[["cpp:dll-export:ICE_API"]]
[["cpp:doxygen:include:Ice/Ice.h"]]
[["cpp:header-ext:h"]]

[["cpp:no-default-include"]]
[["cpp:include:Ice/Config.h"]]
[["cpp:include:Ice/StreamHelpers.h"]]
[["cpp:include:Ice/TupleCompare.h"]]
[["cpp:include:string"]]
[["cpp:include:vector"]]

[["js:module:@zeroc/ice"]]

/// The Ice RPC framework.
#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
["java:identifier:com.zeroc.Ice"]
module Ice
{
/// Represents the identity of an Ice object. It is comparable to the path of a URI. Its string representation is
/// `name` when the category is empty, and `category/name` when the category is not empty.
["cpp:custom-print"]
struct Identity
{
/// The name of the Ice object. An empty name is not valid.
string name;

/// The category of the object.
string category = "";
}

/// A sequence of identities.
sequence<Identity> IdentitySeq;
}
77 changes: 77 additions & 0 deletions Ice/Locator.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (c) ZeroC, Inc.

#pragma once

[["cpp:dll-export:ICE_API"]]
[["cpp:doxygen:include:Ice/Ice.h"]]
[["cpp:header-ext:h"]]

[["cpp:source-include:Ice/LocatorRegistry.h"]]

[["js:module:@zeroc/ice"]]

#include "Identity.ice"

#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
["java:identifier:com.zeroc.Ice"]
module Ice
{
/// The exception that is thrown by a {@link Locator} implementation when it cannot find an object adapter with the
/// provided adapter ID.
exception AdapterNotFoundException
{
}

/// The exception that is thrown by a {@link Locator} implementation when it cannot find an object with the provided
/// identity.
exception ObjectNotFoundException
{
}

interface LocatorRegistry;

/// Client applications use the Locator object to resolve Ice indirect proxies. This object also allows
/// server applications to retrieve a proxy to the associated {@link LocatorRegistry} object where they can register
/// their object adapters.
interface Locator
{
/// Finds an object by identity and returns a dummy proxy with the endpoint(s) that can be used to reach this
/// object. This dummy proxy may be an indirect proxy that requires further resolution using
/// {@link findAdapterById}.
/// @param id The identity.
/// @return A dummy proxy, or null if an object with the requested identity was not found.
/// @throws ObjectNotFoundException Thrown when an object with the requested identity was not found. The caller
/// should treat this exception like a null return value.
["cpp:const"]
idempotent Object* findObjectById(Identity id)
throws ObjectNotFoundException;

/// Finds an object adapter by adapter ID and returns a dummy proxy with the object adapter's endpoint(s).
/// @param id The adapter ID.
/// @return A dummy proxy with the adapter's endpoints, or null if an object adapter with @p id was not found.
/// @throws AdapterNotFoundException Thrown when an object adapter with this adapter ID was not found. The
/// caller should treat this exception like a null return value.
["cpp:const"]
idempotent Object* findAdapterById(string id)
throws AdapterNotFoundException;
Comment on lines +35 to +58
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

These Ice/*.ice definitions don’t appear equivalent to the existing Ice/*.slice (mode=Slice1) versions: e.g., findObjectById takes Identity and returns Object* here, while the Slice1 file uses IdentityPath and returns IceRpc::ServiceAddress?. If the PR’s goal is 1:1 equivalents, the signatures/types need to match; otherwise, please update the PR description (or add a note in these files) to clarify that these are canonical Ice definitions rather than the IceRpc-adapted Slice1 surface.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

They are equivalent on-the-wire. The syntax is not 100% equivalent because of missing features in the .ice syntax, such as custom types.


/// Gets a proxy to the locator registry.
/// @return A proxy to the locator registry, or null if this locator has no associated registry.
["cpp:const"]
idempotent LocatorRegistry* getRegistry();
}

/// Provides access to a {@link Locator} object via a fixed identity.
/// A LocatorFinder is always registered with identity `Ice/LocatorFinder`. This allows clients to obtain the
/// associated Locator proxy with just the endpoint information of the object. For example, you can use the
/// LocatorFinder proxy `Ice/LocatorFinder:tcp -h somehost -p 4061` to get the Locator proxy
/// `MyIceGrid/Locator:tcp -h somehost -p 4061`.
interface LocatorFinder
{
/// Gets a proxy to the associated {@link Locator}. The proxy might point to several replicas.
/// @return The locator proxy. This proxy is never null.
Locator* getLocator();
}
}
80 changes: 80 additions & 0 deletions Ice/LocatorRegistry.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) ZeroC, Inc.

#pragma once

[["cpp:dll-export:ICE_API"]]
[["cpp:doxygen:include:Ice/Ice.h"]]
[["cpp:header-ext:h"]]

[["cpp:source-include:Ice/Process.h"]]

[["js:module:@zeroc/ice"]]

#include "Locator.ice"

#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
["java:identifier:com.zeroc.Ice"]
module Ice
{
interface Process;

/// The exception that is thrown when a server application tries to register endpoints for an object adapter that is
/// already active.
exception AdapterAlreadyActiveException
{
}

/// The exception that is thrown when the provided replica group is invalid.
exception InvalidReplicaGroupIdException
{
}

/// The exception that is thrown when a server was not found.
exception ServerNotFoundException
{
}

/// A server application registers the endpoints of its indirect object adapters with the LocatorRegistry object.
interface LocatorRegistry
{
/// Registers or unregisters the endpoints of an object adapter.
/// @param id The adapter ID.
/// @param proxy A dummy proxy created by the object adapter. @p proxy carries the object adapter's endpoints.
/// The locator considers an object adapter to be active after it has registered its endpoints.
/// When @p proxy is null, the endpoints are unregistered and the locator considers the object adapter inactive.
/// @throws AdapterNotFoundException Thrown when the locator only allows registered object adapters to register
/// their endpoints and no object adapter with this adapter ID was registered with the locator.
/// @throws AdapterAlreadyActiveException Thrown when an object adapter with the same adapter ID has already
/// registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the
/// Ice client runtime retries an invocation with a non-null @p proxy.
idempotent void setAdapterDirectProxy(string id, Object* proxy)
throws AdapterNotFoundException, AdapterAlreadyActiveException;

/// Registers or unregisters the endpoints of an object adapter. This object adapter is a member of a replica
/// group.
/// @param adapterId The adapter ID.
/// @param replicaGroupId The replica group ID.
/// @param proxy A dummy proxy created by the object adapter. @p proxy carries the object adapter's endpoints.
/// The locator considers an object adapter to be active after it has registered its endpoints. When @p proxy is
/// null, the endpoints are unregistered and the locator considers the object adapter inactive.
/// @throws AdapterNotFoundException Thrown when the locator only allows registered object adapters to register
/// their endpoints and no object adapter with this adapter ID was registered with the locator.
/// @throws AdapterAlreadyActiveException Thrown when an object adapter with the same adapter ID has already
/// registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the
/// Ice client runtime retries an invocation with a non-null @p proxy.
/// @throws InvalidReplicaGroupIdException Thrown when the given replica group does not match the replica group
/// associated with the adapter ID in the locator's database.
idempotent void setReplicatedAdapterDirectProxy(string adapterId, string replicaGroupId, Object* proxy)
throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;

/// Registers a proxy to the {@link Process} object of a server application.
/// @param id The server ID.
/// @param proxy A proxy to the {@link Process} object of the server. This proxy is never null.
/// @throws ServerNotFoundException Thrown when the locator does not know a server application with a server ID
/// of @p id.
idempotent void setServerProcessProxy(string id, Process* proxy)
throws ServerNotFoundException;
}
}
26 changes: 26 additions & 0 deletions Ice/Object.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) ZeroC, Inc.

#pragma once

#include "BuiltinSequences.ice"

["cs:identifier:IceRpc.Slice.Ice"]
Comment on lines +6 to +7
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

All other newly-added Ice/*.ice files wrap the C# namespace/identifier override in #ifdef __ICERPC__, but this file applies "cs:identifier:IceRpc.Slice.Ice" unconditionally. If these Slice definitions are ever consumed outside an IceRpc build, this will force the C# namespace unexpectedly. Please wrap this attribute with the same __ICERPC__ guard for consistency and to avoid impacting non-IceRpc consumers.

Suggested change
["cs:identifier:IceRpc.Slice.Ice"]
#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif

Copilot uses AI. Check for mistakes.
module Ice
{
/// Represents the implicit base interface of all Slice interfaces.
["cs:identifier:IceObject"]
Comment on lines +6 to +11
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

Ice/Object.ice is missing several file/module-level directives that are present in the other Ice/*.ice files in this PR (e.g., [["cpp:dll-export:ICE_API"]], [["js:module:@zeroc/ice"]], "java:identifier:com.zeroc.Ice", and the #ifdef __ICERPC__ guard around the C# identifier). If this file is meant to be compiled alongside the rest of the Ice .ice definitions, please add the same directives/guards for consistency and to avoid generating a different API surface for Object than for the rest of the Ice module.

Suggested change
["cs:identifier:IceRpc.Slice.Ice"]
module Ice
{
/// Represents the implicit base interface of all Slice interfaces.
["cs:identifier:IceObject"]
["cpp:dll-export:ICE_API"]
["js:module:@zeroc/ice"]
["java:identifier:com.zeroc.Ice"]
#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
module Ice
{
/// Represents the implicit base interface of all Slice interfaces.
#ifdef __ICERPC__
["cs:identifier:IceObject"]
#endif

Copilot uses AI. Check for mistakes.
interface \Object
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 interface is specific to IceRPC (not copied from zeroc-ice/ice).

{
/// Gets the Slice type IDs of all the interfaces implemented by the target service.
/// @return The Slice type IDs of all these interfaces, sorted alphabetically.
idempotent StringSeq ice_ids();

/// Tests whether the target service implements the specified interface.
/// @param id The Slice type ID of the interface to test against.
/// @return True when the target service implements this interface; otherwise, false.
idempotent bool ice_isA(string id);

/// Pings the service.
idempotent void ice_ping();
}
}
31 changes: 31 additions & 0 deletions Ice/Process.ice
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) ZeroC, Inc.

#pragma once

[["cpp:dll-export:ICE_API"]]
[["cpp:doxygen:include:Ice/Ice.h"]]
[["cpp:header-ext:h"]]

[["js:module:@zeroc/ice"]]

#include "LocatorRegistry.ice"

#ifdef __ICERPC__
["cs:identifier:IceRpc.Slice.Ice"]
#endif
["java:identifier:com.zeroc.Ice"]
module Ice
{
/// A server application managed by a locator implementation such as IceGrid hosts a Process object and registers a
/// proxy to this object with the locator registry. See {@link LocatorRegistry::setServerProcessProxy}.
interface Process
{
/// Initiates a graceful shutdown of the server application.
void shutdown();

/// Writes a message on the server application's stdout or stderr.
/// @param message The message to write.
/// @param fd 1 for stdout, 2 for stderr.
void writeMessage(string message, int fd);
}
}
Loading