1
$\begingroup$

For practicing good data hygiene, designing system architecture, searching, debugging etc it is useful to know what underlying changes are being made to your system when functions like ResourceRegister are used.

Some interactions with WRI folk indicate that registration occurs in PersistentObject's that point to actual storage locations of the full content/meta-data along with documentation statements like:

If the resource is registered in a "local" PersistenceLocation, the resource content will be cached locally withLocalCache[resource]

but take the following sequence:

pl = PersistenceLocation["Local"];
ro = ResourceObject[<|"Name" -> "Ten Primes",
    "ResourceType" -> "Data", "Content" -> Prime[Range[10]]|>];
ror = ResourceRegister[ro, pl];
pl // InputForm

(* PersistenceLocation["Local", 
 "file:///Users/ronaldmonson/Library/Wolfram/Objects/Persistence", 
 Hold[Persistence`Data`a29338699036471582931$7]] *)

where there does not seem to be any change in the PersistenceLocation directory while the data itself seems to be stored in an ".../Objects/Resources/..." directory (and within a "metadata" directory?)

ro["ResourceLocations"]

(* {LocalObject["file:///Users/ronaldmonson/Library/Wolfram/Objects/Resources/185/185d5e50-fcba-4e88-9082-cd59809b3a8b"]} *)

Where does LocalCache come into it as $CacheBaseDirectory appears unmodified?

How does future invocations of ResourceObject[Ten Primes] find the named resource?

Further, how is it updated from corresponding cloud resources?

Finally, on removing the resource

ResourceRemove@ror

there is lingering cruft?

FileExistsQ["/Users/ronaldmonson/Library/Wolfram/Objects/Resources/185/"]
FileExistsQ["/Users/ronaldmonson/Library/Wolfram/Objects/Resources/searchdata/185/"]

(* 
True
True
*)

Is there then, a good mental model of what ResourceRegister is doing internally including what files are being created/modified/updated/searched?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.