public GcpDatastoreMqttIntentStore(IOptions <GcpDatastoreConfig> config, DataStoreKind kind, IMapper mapper) { _kind = kind; _mapper = mapper; _db = DatastoreDb.Create(config.Value.ProjectId, client: string.IsNullOrWhiteSpace(config.Value.KeyJson) ? null : new DatastoreClientBuilder { JsonCredentials = config.Value.KeyJson }.Build()); _keyFactory = _db.CreateKeyFactory(kind.MqttIntentKind); }
public void ReadObject(BinSerializer bs) { uint propIndex; do { propIndex = bs.ReadUInt32(); switch (propIndex) { case 1: Id = bs.ReadUInt64(); break; case 2: Name = bs.ReadString(); break; case 3: Kind = (DataStoreKind)bs.ReadByte(); break; case 0: break; default: throw new Exception($"Deserialize_ObjectUnknownFieldIndex: {GetType().Name} at {propIndex}"); } } while (propIndex != 0); }
public CacheableGcpDataStoreMqttIntentStore(IOptions <GcpDatastoreConfig> config, DataStoreKind kind, IMapper mapper) { _gcpStore = new GcpDatastoreMqttIntentStore(config, kind, mapper); }
internal DataStoreModel(DataStoreKind kind, string provider, string storeName) : base(unchecked ((ulong)StringHelper.GetHashCode(storeName)), storeName) //注意使用一致性Hash产生Id { Kind = kind; Provider = provider; }