public Task Init(string name, Orleans.Providers.IProviderRuntime providerRuntime, Orleans.Providers.IProviderConfiguration config)
 {
     //// prepare provider
     this.Name = name;
     this.directory = config.Properties["directory"];
     return TaskDone.Done;
 }
        public Task ClearStateAsync(string grainType, Orleans.GrainReference grainReference, Orleans.GrainState grainState)
        {
            if (!(grainState is IAggregateState))
                throw new NotAggregateStateException(grainState.GetType());

            var state = grainState as IAggregateState;
            var stream = this.GetStreamName(grainType, grainReference);

            return this.Connection.DeleteStreamAsync(stream, state.Version);
        }
 public Task WriteStateAsync(string grainType, Orleans.Runtime.GrainReference grainReference, Orleans.IGrainState grainState)
 {
     var json = JsonConvert.SerializeObject(grainState.AsDictionary());
     var fileInfo = this.GetFileInfo(grainType, grainReference);
     using (var stream = fileInfo.OpenWrite())
     {
         using (var writer = new StreamWriter(stream))
         {
             return writer.WriteAsync(json);
         }
     }
 }
        public async Task ReadStateAsync(string grainType, Orleans.Runtime.GrainReference grainReference, Orleans.IGrainState grainState)
        {
            var fileInfo = this.GetFileInfo(grainType, grainReference);
            if (!fileInfo.Exists)
            {
                return;
            }

            using (var stream = fileInfo.OpenText())
            {
                var json = await stream.ReadToEndAsync();
                var data = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
                grainState.SetAll(data);
            }
        }
        public Task Init(string name, Orleans.Providers.IProviderRuntime providerRuntime, Orleans.Providers.IProviderConfiguration config)
        {
            this.Name = name;
            this.Log = providerRuntime.GetLogger(this.GetType().FullName, Logger.LoggerType.Application);

            // Create EventStore connection
            var username = config.Properties.ContainsKey("Username") ? config.Properties["Username"] : "******";
            var password = config.Properties.ContainsKey("Password") ? config.Properties["Password"] : "******";

            var settings = ConnectionSettings.Create()
                .KeepReconnecting().KeepRetrying()
                .SetDefaultUserCredentials(new UserCredentials(username, password));

            // Connection string format: <hostName>:<port>
            var connectionStringParts = config.Properties["ConnectionString"].Split(':'); 
            var hostName = connectionStringParts[0];
            var hostPort = int.Parse(connectionStringParts[1]);
            var hostAddress = Dns.GetHostAddresses(hostName).First(a => a.AddressFamily == AddressFamily.InterNetwork);

            this.Connection = EventStoreConnection.Create(settings, new IPEndPoint(hostAddress, hostPort));

            // Connect to EventStore
            return this.Connection.ConnectAsync();
        }
 public static object Deserializer(System.Type expected, Orleans.Serialization.BinaryTokenStreamReader stream)
 {
     Orleans.PingPong.Message result = new Orleans.PingPong.Message();
     return result;
 }
            public System.Threading.Tasks.Task Ping(Orleans.PingPong.IClient from, Orleans.PingPong.Message message)
            {

                return base.InvokeMethodAsync<object>(1491328371, new object[] {from is GrainBase ? Orleans.PingPong.ClientFactory.Cast(from.AsReference()) : from, message}, TimeSpan.Zero );
            }
            public System.Threading.Tasks.Task Subscribe(Orleans.PingPong.IClientObserver subscriber)
            {
GrainFactoryBase.CheckGrainObserverParamInternal(subscriber);

                return base.InvokeMethodAsync<object>(-1238941369, new object[] {subscriber is GrainBase ? Orleans.PingPong.ClientObserverFactory.Cast(subscriber.AsReference()) : subscriber}, TimeSpan.Zero );
            }
            public System.Threading.Tasks.Task Pong(Orleans.PingPong.IDestination from, Orleans.PingPong.Message message)
            {

                return base.InvokeMethodAsync<object>(-2060440583, new object[] {from is GrainBase ? Orleans.PingPong.DestinationFactory.Cast(from.AsReference()) : from, message}, TimeSpan.Zero );
            }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Example.InventoryItemDeactivated input = ((Example.InventoryItemDeactivated)(untypedInput));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Example.InventoryItemCheckedOut input = ((Example.InventoryItemCheckedOut)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Quantity, stream, typeof(int));
 }
            System.Threading.Tasks.Task Orleans.Samples.Chirper.GrainInterfaces.IChirperPublisher.RemoveFollower(string @userAlias, Orleans.Samples.Chirper.GrainInterfaces.IChirperSubscriber @follower)
            {

                return base.InvokeMethodAsync<object>(-370855882, new object[] {@userAlias, @follower is global::Orleans.Grain ? @follower.AsReference<Orleans.Samples.Chirper.GrainInterfaces.IChirperSubscriber>() : @follower} );
            }
            System.Threading.Tasks.Task Orleans.Samples.Chirper.GrainInterfaces.IChirperAccount.ViewerDisconnect(Orleans.Samples.Chirper.GrainInterfaces.IChirperViewer @viewer)
            {
global::Orleans.CodeGeneration.GrainFactoryBase.CheckGrainObserverParamInternal(@viewer);

                return base.InvokeMethodAsync<object>(1708978275, new object[] {@viewer is global::Orleans.Grain ? @viewer.AsReference<Orleans.Samples.Chirper.GrainInterfaces.IChirperViewer>() : @viewer} );
            }
            System.Threading.Tasks.Task Orleans.Samples.Chirper.GrainInterfaces.IChirperAccount.SetUserDetails(Orleans.Samples.Chirper.GrainInterfaces.ChirperUserInfo @userInfo)
            {

                return base.InvokeMethodAsync<object>(957692321, new object[] {@userInfo} );
            }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     JASN.Core.Customer input = ((JASN.Core.Customer)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Id, stream, typeof(int));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Name, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Total, stream, typeof(decimal));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Test.Interfaces.PersonalAttributes input = ((Test.Interfaces.PersonalAttributes)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.FirstName, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.LastName, stream, typeof(string));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Example.InventoryItemDetails input = ((Example.InventoryItemDetails)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Active, stream, typeof(bool));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Name, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Total, stream, typeof(int));
 }
            System.Threading.Tasks.Task Orleans.Samples.Chirper.GrainInterfaces.IChirperSubscriber.NewChirp(Orleans.Samples.Chirper.GrainInterfaces.ChirperMessage @chirp)
            {

                return base.InvokeMethodAsync<object>(-1105116289, new object[] {@chirp} );
            }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Example.CreateInventoryItem input = ((Example.CreateInventoryItem)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Name, stream, typeof(string));
 }
            void Orleans.Samples.Chirper.GrainInterfaces.IChirperViewer.NewChirpArrived(Orleans.Samples.Chirper.GrainInterfaces.ChirperMessage @chirp)
            {

                    base.InvokeOneWayMethod(-343496927, new object[] {@chirp} );
            }
Exemple #21
0
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Microsoft.AspNet.SignalR.Messaging.Message input = ((Microsoft.AspNet.SignalR.Messaging.Message)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.CommandId, stream, typeof(String));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Encoding, stream, typeof(Encoding));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Filter, stream, typeof(String));
     Orleans.Serialization.SerializationManager.SerializeInner(input.IsAck, stream, typeof(Boolean));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Key, stream, typeof(String));
     Orleans.Serialization.SerializationManager.SerializeInner(input.MappingId, stream, typeof(UInt64));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Source, stream, typeof(String));
     Orleans.Serialization.SerializationManager.SerializeInner(input.StreamIndex, stream, typeof(Int32));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Value, stream, typeof(ArraySegment<Byte>));
     Orleans.Serialization.SerializationManager.SerializeInner(input.WaitForAck, stream, typeof(Boolean));
 }
            void Orleans.Samples.Chirper.GrainInterfaces.IChirperViewer.SubscriptionAdded(Orleans.Samples.Chirper.GrainInterfaces.ChirperUserInfo @following)
            {

                    base.InvokeOneWayMethod(489541775, new object[] {@following} );
            }
            public System.Threading.Tasks.Task Initialize(Orleans.PingPong.IDestination actor, long repeats)
            {

                return base.InvokeMethodAsync<object>(1682027821, new object[] {actor is GrainBase ? Orleans.PingPong.DestinationFactory.Cast(actor.AsReference()) : actor, repeats}, TimeSpan.Zero );
            }
            void Orleans.Samples.Chirper.GrainInterfaces.IChirperViewer.SubscriptionRemoved(Orleans.Samples.Chirper.GrainInterfaces.ChirperUserInfo @notFollowing)
            {

                    base.InvokeOneWayMethod(1797324738, new object[] {@notFollowing} );
            }
 public static object _Deserializer(System.Type expected, Orleans.Serialization.BinaryTokenStreamReader stream)
 {
     return DestinationReference.Cast(((Orleans.GrainReference)(GrainReference.DeserializeGrainReference(expected, stream))));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Orleans.Samples.Chirper.GrainInterfaces.ChirperMessage input = ((Orleans.Samples.Chirper.GrainInterfaces.ChirperMessage)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Message, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.MessageId, stream, typeof(System.Guid));
     Orleans.Serialization.SerializationManager.SerializeInner(input.PublisherAlias, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.PublisherId, stream, typeof(long));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Timestamp, stream, typeof(System.DateTime));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     Orleans.PingPong.Message input = ((Orleans.PingPong.Message)(untypedInput));
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     EventJournal.Event input = ((EventJournal.Event)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.AdditionalData, stream, typeof(System.Collections.Generic.IDictionary<System.String,Newtonsoft.Json.Linq.JToken>));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Arguments, stream, typeof(object[]));
     Orleans.Serialization.SerializationManager.SerializeInner(input.CorrelationId, stream, typeof(System.Guid));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Extras, stream, typeof(System.Collections.Generic.Dictionary<System.String,System.Object>));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Id, stream, typeof(long));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Time, stream, typeof(System.DateTime));
     Orleans.Serialization.SerializationManager.SerializeInner(input.To, stream, typeof(EventJournal.Address));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Type, stream, typeof(string));
     Orleans.Serialization.SerializationManager.SerializeInner(input.UserId, stream, typeof(System.Nullable<System.Guid>));
 }
 public static void _Serializer(object original, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     ClientReference input = ((ClientReference)(original));
     GrainReference.SerializeGrainReference(input, stream, expected);
 }
 public static void Serializer(object untypedInput, Orleans.Serialization.BinaryTokenStreamWriter stream, System.Type expected)
 {
     EventJournal.Address input = ((EventJournal.Address)(untypedInput));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Id, stream, typeof(System.Guid));
     Orleans.Serialization.SerializationManager.SerializeInner(input.Kind, stream, typeof(string));
 }