Skip to content

Make defrecords public so they can be extended#14

Open
transducer wants to merge 1 commit into
ovotech:masterfrom
transducer:master
Open

Make defrecords public so they can be extended#14
transducer wants to merge 1 commit into
ovotech:masterfrom
transducer:master

Conversation

@transducer

Copy link
Copy Markdown

Hi,

We are using this library (thanks!) and want to add a new function to the implementations of StorageClient, namely bucket-exists?. To do this now we have to create our own StorageClient protocol with the extra method, and then create two deftypes that wrap the implementations of FileSystemStorageClient and GCSStorageClient, and just dispatch to the functions of the client in this library. If would be much nicer if we could do this:

(defprotocol IBucketExists
  (bucket-exists? [this bucket-name]))

(extend-type GCSStorageClient
  IBucketExists
  (bucket-exists? [this bucket-name] ...))

Because the defrecord is private this is not possible.

This PR makes them public. Let me if you have any questions or concerns.

Kind regards,
Erwin

@transducer

Copy link
Copy Markdown
Author

We found a workaround:

(:import
   (clj_gcp.storage.core FileSystemStorageClient GCSStorageClient))

I do think it would be nicer just to use Clojure and not Java interop to access the defrecords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant