public AdoNetReminderTable(
     GrainReferenceKeyStringConverter grainReferenceConverter,
     IOptions <ClusterOptions> clusterOptions,
     IOptions <AdoNetReminderTableOptions> storageOptions)
 {
     this.grainReferenceConverter = grainReferenceConverter;
     this.serviceId = clusterOptions.Value.ServiceId;
     this.options   = storageOptions.Value;
 }
 /// <summary>Initializes a new instance of the <see cref="DynamoDBReminderTable"/> class.</summary>
 /// <param name="grainReferenceConverter">The grain factory.</param>
 /// <param name="loggerFactory">logger factory to use</param>
 /// <param name="clusterOptions"></param>
 /// <param name="storageOptions"></param>
 public DynamoDBReminderTable(
     GrainReferenceKeyStringConverter grainReferenceConverter,
     ILoggerFactory loggerFactory,
     IOptions <ClusterOptions> clusterOptions,
     IOptions <DynamoDBReminderStorageOptions> storageOptions)
 {
     this.grainReferenceConverter = grainReferenceConverter;
     this.logger    = loggerFactory.CreateLogger <DynamoDBReminderTable>();
     this.serviceId = clusterOptions.Value.ServiceId;
     this.options   = storageOptions.Value;
 }
Exemple #3
0
 public AdoNetClusteringTable(
     GrainReferenceKeyStringConverter grainReferenceConverter,
     IOptions <ClusterOptions> clusterOptions,
     IOptions <AdoNetClusteringSiloOptions> clusteringOptions,
     ILogger <AdoNetClusteringTable> logger)
 {
     this.grainReferenceConverter = grainReferenceConverter;
     this.logger = logger;
     this.clusteringTableOptions = clusteringOptions.Value;
     this.clusterId = clusterOptions.Value.ClusterId;
 }
 public AzureBasedReminderTable(
     GrainReferenceKeyStringConverter grainReferenceConverter,
     ILoggerFactory loggerFactory,
     IOptions <ClusterOptions> clusterOptions,
     IOptions <AzureTableReminderStorageOptions> storageOptions)
 {
     this.grainReferenceConverter = grainReferenceConverter;
     this.logger         = loggerFactory.CreateLogger <AzureBasedReminderTable>();
     this.loggerFactory  = loggerFactory;
     this.clusterOptions = clusterOptions.Value;
     this.storageOptions = storageOptions.Value;
 }
Exemple #5
0
 public AdoNetGatewayListProvider(
     ILogger <AdoNetGatewayListProvider> logger,
     GrainReferenceKeyStringConverter grainReferenceConverter,
     IOptions <AdoNetClusteringClientOptions> options,
     IOptions <GatewayOptions> gatewayOptions,
     IOptions <ClusterOptions> clusterOptions)
 {
     this.logger = logger;
     this.grainReferenceConverter = grainReferenceConverter;
     this.options      = options.Value;
     this.clusterId    = clusterOptions.Value.ClusterId;
     this.maxStaleness = gatewayOptions.Value.GatewayListRefreshPeriod;
 }
Exemple #6
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public DynamoDBGrainStorage(
     string name,
     DynamoDBStorageOptions options,
     SerializationManager serializationManager,
     IServiceProvider serviceProvider,
     GrainReferenceKeyStringConverter grainReferenceConverter,
     ILogger <DynamoDBGrainStorage> logger)
 {
     this.name    = name;
     this.logger  = logger;
     this.options = options;
     this.serializationManager    = serializationManager;
     this.serviceProvider         = serviceProvider;
     this.grainReferenceConverter = grainReferenceConverter;
 }
            internal static ReminderEntry GetReminderEntry(IDataRecord record, GrainReferenceKeyStringConverter grainReferenceConverter)
            {
                //Having non-null field, GrainId, means with the query filter options, an entry was found.
                string grainId = record.GetValueOrDefault <string>(nameof(Columns.GrainId));

                if (grainId != null)
                {
                    return(new ReminderEntry
                    {
                        GrainRef = grainReferenceConverter.FromKeyString(grainId),
                        ReminderName = record.GetValue <string>(nameof(Columns.ReminderName)),
                        StartAt = record.GetDateTimeValue(nameof(Columns.StartTime)),

                        //Use the GetInt64 method instead of the generic GetValue<TValue> version to retrieve the value from the data record
                        //GetValue<int> causes an InvalidCastException with oracle data provider. See https://github.com/dotnet/orleans/issues/3561
                        Period = TimeSpan.FromMilliseconds(record.GetInt64(nameof(Columns.Period))),
                        ETag = GetVersion(record).ToString()
                    });
                }
                return(null);
            }
        /// <summary>
        /// Creates an instance of a database of type <see cref="RelationalOrleansQueries"/> and Initializes Orleans queries from the database.
        /// Orleans uses only these queries and the variables therein, nothing more.
        /// </summary>
        /// <param name="invariantName">The invariant name of the connector for this database.</param>
        /// <param name="connectionString">The connection string this database should use for database operations.</param>
        /// <param name="grainReferenceConverter"></param>
        internal static async Task <RelationalOrleansQueries> CreateInstance(string invariantName, string connectionString, GrainReferenceKeyStringConverter grainReferenceConverter)
        {
            var storage = RelationalStorage.CreateInstance(invariantName, connectionString);

            var queries = await storage.ReadAsync(DbStoredQueries.GetQueriesKey, DbStoredQueries.Converters.GetQueryKeyAndValue, null);

            return(new RelationalOrleansQueries(storage, new DbStoredQueries(queries.ToDictionary(q => q.Key, q => q.Value)), grainReferenceConverter));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="storage">the underlying relational storage</param>
 /// <param name="dbStoredQueries">Orleans functional queries</param>
 /// <param name="grainReferenceConverter"></param>
 private RelationalOrleansQueries(IRelationalStorage storage, DbStoredQueries dbStoredQueries, GrainReferenceKeyStringConverter grainReferenceConverter)
 {
     this.storage                 = storage;
     this.dbStoredQueries         = dbStoredQueries;
     this.grainReferenceConverter = grainReferenceConverter;
 }