internal RiakBucketProperties(RpbBucketProps bucketProps)
            : this()
        {
            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;

            RVal = bucketProps.r;
            RwVal = bucketProps.rw;
            DwVal = bucketProps.dw;
            WVal = bucketProps.w;
            PrVal = bucketProps.pr;
            PwVal = bucketProps.pw;

            Search = 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;
        }
        internal RpbBucketProps ToMessage()
        {
            var message = new RpbBucketProps();

            if(AllowMultiple.HasValue)
            {
                message.allow_mult = AllowMultiple.Value;
            }

            if(NVal.HasValue)
            {
                message.n_val = NVal.Value;
            }

            if (LastWriteWins.HasValue)
            {
                message.last_write_wins = LastWriteWins.Value;
            }

            if (RVal.HasValue)
            {
                message.r = RVal.Value;
            }

            if (RwVal.HasValue)
            {
                message.rw = RwVal.Value;
            }

            if (DwVal.HasValue)
            {
                message.dw = DwVal.Value;
            }

            if (WVal.HasValue)
            {
                message.w = WVal.Value;
            }

            if (PrVal.HasValue)
            {
                message.pr = PrVal.Value;
            }

            if (PwVal.HasValue)
            {
                message.pw = PwVal.Value;
            }

            if (Search.HasValue)
            {
                message.search = Search.Value;
            }

            if (HasPrecommit.HasValue)
            {
                message.has_precommit = HasPrecommit.Value;
            }

            // Due to the amusing differences between 1.3 and 1.4 we've added
            // this elegant shim to figure out if we should add commit hooks,
            // remove them, or just wander around setting the Search boolean.
            if (_addHooks.HasValue)
            {
                if (_addHooks.Value)
                {
                    AddPreCommitHook(RiakErlangCommitHook.RiakSearchCommitHook);
                }
                else
                {
                    RemovePreCommitHook(RiakErlangCommitHook.RiakSearchCommitHook);
                }
            }

            if (PreCommitHooks != null)
            {
                PreCommitHooks.ForEach(h =>
                    {
                        var hook = h.ToRpbCommitHook();
                        if (!message.precommit.Any(x => Equals(x, hook)))
                            message.precommit.Add(hook);
                    });
            }

            if (HasPostcommit.HasValue)
            {
                message.has_postcommit = HasPostcommit.Value;
            }

            if (PostCommitHooks != null)
            {
                PostCommitHooks.ForEach(h =>
                    {
                        var hook = h.ToRpbCommitHook();
                        if (!message.postcommit.Any(x => Equals(x, hook)))
                            message.postcommit.Add(hook);
                    });
            }

            return message;
        }
 internal RpbBucketProps ToMessage()
 {
     var message = new RpbBucketProps();
     if(AllowMultiple.HasValue)
     {
         message.AllowMultiple = AllowMultiple.Value;
     }
     if(NVal.HasValue)
     {
         message.NVal = NVal.Value;
     }
     return message;
 }
 internal RiakBucketProperties(RpbBucketProps bucketProps)
     : this()
 {
     AllowMultiple = bucketProps.AllowMultiple;
     NVal = bucketProps.NVal;
 }
 internal RiakBucketProperties(RpbBucketProps bucketProps)
     : this()
 {
     AllowMultiple = bucketProps.allow_mult;
     NVal = bucketProps.n_val;
 }