class Riak::BucketType

A representation of a bucket type

Constants

DEFAULT_NAME

The name of Riak's default bucket type.

Attributes

client[R]
name[R]

Public Class Methods

new(client, name) click to toggle source

Create a bucket type object manually. @param [Client] client the {Riak::Client} for this bucket type @param [String] name the name of this bucket type

# File lib/riak/bucket_type.rb, line 18
def initialize(client, name)
  @client, @name = client, name
end

Public Instance Methods

==(other) click to toggle source
# File lib/riak/bucket_type.rb, line 73
def ==(other)
  return false unless self.class == other.class
  return false unless self.client == other.client
  return equal_bytes?(self.name, other.name)
end
bucket(bucket_name) click to toggle source

Get a bucket of this type @param [String] bucket_name the name of this bucket

# File lib/riak/bucket_type.rb, line 30
def bucket(bucket_name)
  BucketTyped::Bucket.new client, bucket_name, self
end
data_type_class() click to toggle source

Return the data type used for handling the CRDT stored in this bucket type. Returns `nil` for a non-CRDT bucket type. @raise [Riak::CrdtError::UnrecognizedDataType] if the bucket type has an

unknown datatype

@return [Class<Riak::Crdt::Base>] CRDT subclass to use with this bucket

type
# File lib/riak/bucket_type.rb, line 58
def data_type_class
  return nil unless dt = properties[:datatype]
  parent = Riak::Crdt
  case dt
  when 'counter'
    parent::Counter
  when 'map'
    parent::Map
  when 'set'
    parent::Set
  else
    raise CrdtError::UnrecognizedDataType.new dt
  end
end
default?() click to toggle source

Is this bucket type the default? @return [Boolean]

# File lib/riak/bucket_type.rb, line 24
def default?
  name == DEFAULT_NAME
end
pretty_print(pp) click to toggle source

Pretty prints the bucket for `pp` or `pry`.

# File lib/riak/bucket_type.rb, line 35
def pretty_print(pp)
  pp.object_group self do
    pp.breakable
    pp.text "name=#{name}"
  end
end
properties() click to toggle source

Get the properties of this bucket type @return [Hash<Symbol,Object>]

# File lib/riak/bucket_type.rb, line 44
def properties
  @properties ||= client.backend do |be|
    be.get_bucket_type_props name
  end
end
Also aliased as: props
props()
Alias for: properties