internal KeyValue(IConnection connection, string bucketName, KeyValueOptions kvo) { BucketName = Validator.ValidateKvBucketNameRequired(bucketName); StreamName = KeyValueUtil.ToStreamName(BucketName); StreamSubject = KeyValueUtil.ToStreamSubject(BucketName); RawKeyPrefix = KeyValueUtil.ToKeyPrefix(bucketName); if (kvo == null) { js = new JetStream.JetStream(connection, null); jsm = new JetStreamManagement(connection, null); PubSubKeyPrefix = RawKeyPrefix; } else { js = new JetStream.JetStream(connection, kvo.JSOptions); jsm = new JetStreamManagement(connection, kvo.JSOptions); if (kvo.JSOptions.IsDefaultPrefix) { PubSubKeyPrefix = RawKeyPrefix; } else { PubSubKeyPrefix = kvo.JSOptions.Prefix + RawKeyPrefix; } } }
/// <summary> /// Builds the KeyValueConfiguration /// </summary> /// <returns>the KeyValueConfiguration</returns> public KeyValueConfiguration Build() { _name = Validator.ValidateKvBucketNameRequired(_name); scBuilder.WithName(KeyValueUtil.ToStreamName(_name)) .WithSubjects(KeyValueUtil.ToStreamSubject(_name)) .WithAllowRollup(true) .WithDiscardPolicy(DiscardPolicy.New) .WithDenyDelete(true); return(new KeyValueConfiguration(scBuilder.Build())); }
public void Delete(string bucketName) { Validator.ValidateKvBucketNameRequired(bucketName); jsm.DeleteStream(KeyValueUtil.ToStreamName(bucketName)); }
public KeyValueStatus GetBucketInfo(string bucketName) { Validator.ValidateKvBucketNameRequired(bucketName); return(new KeyValueStatus(jsm.GetStreamInfo(KeyValueUtil.ToStreamName(bucketName)))); }
public KeyValueStatus Status() { return(new KeyValueStatus(jsm.GetStreamInfo(KeyValueUtil.ToStreamName(BucketName)))); }