Пример #1
0
        public void WhenUsingValidNVal_CanBeCastToUint()
        {
            int random = r.Next();
            var nval   = new NVal(random);

            Assert.AreEqual((uint)random, (uint)nval);
        }
        internal RiakBucketProperties(RpbBucketProps bucketProps)
        {
            NVal          = new NVal(bucketProps.n_val);
            AllowMultiple = bucketProps.allow_mult;
            LastWriteWins = bucketProps.last_write_wins;
            Backend       = bucketProps.backend.FromRiakString();
            NotFoundOk    = bucketProps.notfound_ok;
            BasicQuorum   = bucketProps.basic_quorum;

            HasPrecommit  = bucketProps.has_precommit;
            HasPostcommit = bucketProps.has_postcommit;

            R  = (Quorum)bucketProps.r;
            Rw = (Quorum)bucketProps.rw;
            Dw = (Quorum)bucketProps.dw;
            W  = (Quorum)bucketProps.w;
            Pr = (Quorum)bucketProps.pr;
            Pw = (Quorum)bucketProps.pw;

            LegacySearch = bucketProps.search;

            HasPrecommit  = bucketProps.has_precommit;
            HasPostcommit = bucketProps.has_postcommit;

            var preCommitHooks = bucketProps.precommit;

            if (preCommitHooks.Count > 0)
            {
                PreCommitHooks = preCommitHooks.Select(LoadPreCommitHook).ToList();
            }

            var postCommitHooks = bucketProps.postcommit;

            if (postCommitHooks.Count > 0)
            {
                PostCommitHooks = postCommitHooks.Select(LoadPostCommitHook).ToList();
            }

            ReplicationMode = (RiakConstants.RiakEnterprise.ReplicationMode)bucketProps.repl;

            SearchIndex = bucketProps.search_index.FromRiakString();
            DataType    = bucketProps.datatype.FromRiakString();

            Consistent = bucketProps.consistent;

            if (bucketProps.hll_precisionSpecified)
            {
                HllPrecision = (int)bucketProps.hll_precision;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchIndex"/> class.
        /// </summary>
        /// <param name="indexName">The name of the index.</param>
        /// <param name="schemaName">The name of the schema for the index.</param>
        /// <param name="nval">The <see cref="NVal"/> value for storing index entries.</param>
        /// <exception cref="ArgumentException"><paramref name="indexName"/> cannot be null, zero length, or whitespace</exception>
        /// <exception cref="ArgumentException"><paramref name="schemaName"/> cannot be null, zero length, or whitespace</exception>
        /// <exception cref="ArgumentOutOfRangeException">The value of <paramref name="nval"/> must not be null.</exception>
        public SearchIndex(string indexName, string schemaName, NVal nval)
        {
            if (string.IsNullOrWhiteSpace(indexName))
            {
                throw new ArgumentException("Index Name cannot be null, zero length, or whitespace.");
            }

            if (string.IsNullOrWhiteSpace(schemaName))
            {
                throw new ArgumentException("Schema Name cannot be null, zero length, or whitespace.");
            }

            if (nval == null)
            {
                throw new ArgumentOutOfRangeException("nval", "nval must not be null.");
            }

            this.name = indexName;
            this.nval = nval;
            this.schemaName = schemaName;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchIndex"/> class.
        /// </summary>
        /// <param name="indexName">The name of the index.</param>
        /// <param name="schemaName">The name of the schema for the index.</param>
        /// <param name="nval">The <see cref="NVal"/> value for storing index entries.</param>
        /// <exception cref="ArgumentException"><paramref name="indexName"/> cannot be null, zero length, or whitespace</exception>
        /// <exception cref="ArgumentException"><paramref name="schemaName"/> cannot be null, zero length, or whitespace</exception>
        /// <exception cref="ArgumentOutOfRangeException">The value of <paramref name="nval"/> must not be null.</exception>
        public SearchIndex(string indexName, string schemaName, NVal nval)
        {
            if (string.IsNullOrWhiteSpace(indexName))
            {
                throw new ArgumentException("Index Name cannot be null, zero length, or whitespace.");
            }

            if (string.IsNullOrWhiteSpace(schemaName))
            {
                throw new ArgumentException("Schema Name cannot be null, zero length, or whitespace.");
            }

            if (nval == null)
            {
                throw new ArgumentOutOfRangeException("nval", "nval must not be null.");
            }

            this.name       = indexName;
            this.nval       = nval;
            this.schemaName = schemaName;
        }
Пример #5
0
 /// <summary>
 /// Sets N[s,a]'s value
 /// </summary>
 /// <param name="s">The state</param>
 /// <param name="a">The action</param>
 /// <param name="e">The value to be updated</param>
 protected virtual void __set_nsa_value(State s, Action a, NVal e) { var sig = new StateAction(s, a); if (!this.NSA.Contains(sig)) this.NSA.Add(sig, e); else this.NSA[sig] = e; }
Пример #6
0
 /// <summary>
 /// Sets T-Value's value
 /// </summary>
 /// <param name="s">The state</param>
 /// <param name="a">The action</param>
 /// <param name="sprim">The next state</param>
 /// <param name="e">The value to be updated</param>
 protected virtual void __set_t_value(State s, Action a, State sprim, NVal e) { var sig = new StateActionState(s, new KeyValuePair<Action, State>(a, sprim)); if (!this.TTable.Contains(sig)) this.TTable.Add(sig, e); else this.TTable[sig] = e; }
 /// <summary>
 /// Fluent setter for the <see cref="NVal"/> property.
 /// The number of replicas to create when storing data.
 /// </summary>
 /// <param name="value">The value to set the property to.</param>
 /// <returns>A reference to the current properties object.</returns>
 /// <remarks>
 /// This property is not typically modified.
 /// </remarks>
 public RiakBucketProperties SetNVal(NVal value)
 {
     NVal = value;
     return(this);
 }
 /// <summary>
 /// Fluent setter for the <see cref="NVal"/> property.
 /// The number of replicas to create when storing data.
 /// </summary>
 /// <param name="value">The value to set the property to.</param>
 /// <returns>A reference to the current properties object.</returns>
 /// <remarks>
 /// This property is not typically modified.
 /// </remarks>
 public RiakDtUpdateOptions SetNVal(NVal value)
 {
     NVal = value;
     return(this);
 }
 internal SearchIndex(RpbYokozunaIndex index)
 {
     this.name = index.name.FromRiakString();
     this.schemaName = index.schema.FromRiakString();
     this.nval = new NVal(index.n_val);
 }
Пример #10
0
 /// <summary>
 /// Fluent setter for the <see cref="NVal"/> property.
 /// The number of replicas to create when storing data.
 /// </summary>
 /// <param name="value">The value to set the property to.</param>
 /// <returns>A reference to the current properties object.</returns>
 /// <remarks>
 /// This property is not typically modified.
 /// </remarks>
 public RiakDtFetchOptions SetNVal(NVal value)
 {
     NVal = value;
     return(this);
 }
 public void WhenUsingValidNVal_CanBeCastToUint()
 {
     int random = r.Next();
     var nval = new NVal(random);
     Assert.AreEqual((uint)random, (uint)nval);
 }
Пример #12
0
 internal SearchIndex(RpbYokozunaIndex index)
 {
     this.name       = index.name.FromRiakString();
     this.schemaName = index.schema.FromRiakString();
     this.nval       = new NVal(index.n_val);
 }