class NATS::Objects::Client

Defined in:

objects.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(nats : NATS::Client) #

[View source]

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)

[View source]
def delete_bucket(name : String) #

[View source]
def get(bucket : String, key : String) : IO | Nil #

[View source]
def get_bucket(name : String) #

[View source]
def get_info(bucket : String, key : String) #

[View source]
def keys(bucket : String, pattern : String = ">") : Set(String) #

[View source]
def put(bucket : String, key : String, value : IO, description : String | Nil = nil, headers : Headers = Headers.new, chunk_size : Int = DEFAULT_CHUNK_SIZE) #

[View source]
def watch(bucket : String, key : String, &block : ObjectInfo, Watch -> ) #

[View source]