class NATS::Objects::Client
- NATS::Objects::Client
- Reference
- Object
Defined in:
objects.crConstructors
Instance Method Summary
-
#create_bucket(name : String, description : String = "", *, ttl : Time::Span | Nil = nil, storage : JetStream::StreamConfig::Storage = :file, replicas : Int | Nil = nil, max_bytes : Int | Nil = nil, placement : JetStream::StreamConfig::Placement | Nil = nil)
Create a bucket in the object store
- #delete_bucket(name : String)
- #get(bucket : String, key : String) : IO | Nil
- #get_bucket(name : String)
- #get_info(bucket : String, key : String)
- #keys(bucket : String, pattern : String = ">") : Set(String)
- #put(bucket : String, key : String, value : IO, description : String | Nil = nil, headers : Headers = Headers.new, chunk_size : Int = DEFAULT_CHUNK_SIZE)
- #watch(bucket : String, key : String, &block : ObjectInfo, Watch -> )
Constructor Detail
Instance Method Detail
def create_bucket(name : String, description : String = "", *, ttl : Time::Span | Nil = nil, storage : JetStream::StreamConfig::Storage = :file, replicas : Int | Nil = nil, max_bytes : Int | Nil = nil, placement : JetStream::StreamConfig::Placement | Nil = nil)
#
Create a bucket in the object store
bucket = nats.objects.create_bucket("my-bucket")
Give the bucket a description that will show up when you get bucket metadata
bucket = nats.objects.create_bucket("uploads", description: "Storage for user uploads")
Set a maximum lifetime for your objects, after which they are deleted:
bucket = nats.objects.create_bucket("snapchat-images", ttl: 1.day)
Replicate your objects across multiple NATS servers in your cluster:
bucket = nats.objects.create_bucket("durable-storage", replicas: 3)