orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Read State values from external tool

Open ponsakthi opened this issue 11 years ago • 4 comments

For obvious debugging purpose once the Silo is hosted on Azure Cloud Service, there is a need for external tool which can read and output the state of a grain given the grain type and its primary key (by connecting to the storage account of the grain and de-serializing the byte array data)

Is there any tool available now or is there a plan to develop one?

ponsakthi avatar Sep 22 '15 13:09 ponsakthi

There is no such a tool available now, but it should be possible and not too hard to build it. One can start by taking OrleansManager tool and adding the extra option of reading the state to it. It will have to load and instantiate the storage provider and use it. This is all easy. One problem that we might run into is that Storage Providers were meant to be used from within the Grain so it might not work out of the box, but I am sure we can enable a mode of calling the storage provider from the client.

gabikliot avatar Sep 22 '15 18:09 gabikliot

+1 @ponsakthi for the idea. Well, when I had a look at ReadMe file of OrleansManager, it says

b.  The second argument is the grain type code. You can find it in the generated code.  
        For example, for MachineGrain it was:
        public static IMachineGrain GetGrain(long primaryKey)
        {
            return Cast(GrainFactoryBase.MakeSelfManagedGrainReferenceInternal(typeof(IMachineGrain), 430913052, primaryKey));
        }
        430913052 is the type code for this grain.  

But I was not able to locate GrainFactoryBase.MakeSelfManagedGrainReferenceInternal in my generated code. More over this method is not part of the latest Orleans code as well. @gabikliot , Is it possible to update the ReadMe file to get type code of the grain using the latest code.?

shubhanjalik avatar Sep 23 '15 17:09 shubhanjalik

Yes, I will update the readme.

gabikliot avatar Sep 23 '15 18:09 gabikliot

I updated the readme.

gabikliot avatar Sep 24 '15 04:09 gabikliot