Object Store

NOTICE: Experimental Preview

The Object Store allows you to store data of any (i.e. large) size by implementing a chunking mechanism, allowing you to for example store and retrieve files (i.e. the object) of any size by associating them with a path and a file name (i.e. the key). You obtain a ObjectStoreManager object from your JetStream context.

Go

  1. // ObjectStoreManager creates, loads and deletes Object Stores
  2. //
  3. // Notice: Experimental Preview
  4. //
  5. // This functionality is EXPERIMENTAL and may be changed in later releases.
  6. type ObjectStoreManager interface {
  7. // ObjectStore will lookup and bind to an existing object store instance.
  8. ObjectStore(bucket string) (ObjectStore, error)
  9. // CreateObjectStore will create an object store.
  10. CreateObjectStore(cfg *ObjectStoreConfig) (ObjectStore, error)
  11. // DeleteObjectStore will delete the underlying stream for the named object.
  12. DeleteObjectStore(bucket string) error
  13. }
  14. // ObjectStore is a blob store capable of storing large objects efficiently in
  15. // JetStream streams
  16. //
  17. // Notice: Experimental Preview
  18. //
  19. // This functionality is EXPERIMENTAL and may be changed in later releases.
  20. type ObjectStore interface {
  21. // Put will place the contents from the reader into a new object.
  22. Put(obj *ObjectMeta, reader io.Reader, opts ...ObjectOpt) (*ObjectInfo, error)
  23. // Get will pull the named object from the object store.
  24. Get(name string, opts ...ObjectOpt) (ObjectResult, error)
  25. // PutBytes is convenience function to put a byte slice into this object store.
  26. PutBytes(name string, data []byte, opts ...ObjectOpt) (*ObjectInfo, error)
  27. // GetBytes is a convenience function to pull an object from this object store and return it as a byte slice.
  28. GetBytes(name string, opts ...ObjectOpt) ([]byte, error)
  29. // PutBytes is convenience function to put a string into this object store.
  30. PutString(name string, data string, opts ...ObjectOpt) (*ObjectInfo, error)
  31. // GetString is a convenience function to pull an object from this object store and return it as a string.
  32. GetString(name string, opts ...ObjectOpt) (string, error)
  33. // PutFile is convenience function to put a file into this object store.
  34. PutFile(file string, opts ...ObjectOpt) (*ObjectInfo, error)
  35. // GetFile is a convenience function to pull an object from this object store and place it in a file.
  36. GetFile(name, file string, opts ...ObjectOpt) error
  37. // GetInfo will retrieve the current information for the object.
  38. GetInfo(name string) (*ObjectInfo, error)
  39. // UpdateMeta will update the meta data for the object.
  40. UpdateMeta(name string, meta *ObjectMeta) error
  41. // Delete will delete the named object.
  42. Delete(name string) error
  43. // AddLink will add a link to another object into this object store.
  44. AddLink(name string, obj *ObjectInfo) (*ObjectInfo, error)
  45. // AddBucketLink will add a link to another object store.
  46. AddBucketLink(name string, bucket ObjectStore) (*ObjectInfo, error)
  47. // Seal will seal the object store, no further modifications will be allowed.
  48. Seal() error
  49. // Watch for changes in the underlying store and receive meta information updates.
  50. Watch(opts ...WatchOpt) (ObjectWatcher, error)
  51. // List will list all the objects in this store.
  52. List(opts ...WatchOpt) ([]*ObjectInfo, error)
  53. // Status retrieves run-time status about the backing store of the bucket.
  54. Status() (ObjectStoreStatus, error)
  55. }

{% endtabs %}