[CBMA-19] Need API for external path to CouchbaseMobile Created: 31/Oct/11 Updated: 15/Oct/12 Resolved: 15/Oct/12 |
|
| Status: | Resolved |
| Project: | Couchbase Mobile Android |
| Component/s: | SDK |
| Affects Version/s: | 2.0-beta |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Perry Krug | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
A request for a small improvement for your Android API: You offer a method CouchbaseMobile.externalPath() to get the external path for Couchbase Mobile. We have implemented some kind of quota control that limits the used diskspace, so we need to find out the path where CouchDB stores its database files. Unfortunately this is a sub-folder of the one returned by externalPath(). We implemented a method on our own that returns new File(externalPath(), "/db/"); but that should be included in your CouchbaseMobile class (name of db folder could be changed) and used by CouchbaseMobile.installDatabase(String) as well.
|
| Comments |
| Comment by J Chris Anderson [ 01/Nov/11 ] |
|
Will it work to execute this request against the running server?
GET /_config/couchdb/database_dir This is the single point of truth for the answer you seek, so our API would just be querying this anyway: |
| Comment by Perry Krug [ 04/Nov/11 ] |
| This works but implementing an asynchronous HTTP-GET with parsing afterwards and additional error handling would not be appropriate for only getting this directory. So far we have a working solution but we want the one-liner I suggested on your side rather than on our side because you might want to change the name of the “db”-subfolder for some reason. |
| Comment by Perry Krug [ 16/Nov/11 ] |
|
This is what is desired:
Class CouchbaseMobile: public static File databaseDir() { return new File(externalPath(), "db"); } And its usage in CouchbaseMobile.installDatabase(): public void installDatabase(String fileName) throws IOException { File destination = new File(databaseDir(), fileName); copyIffNotExists(fileName, destination); } |
| Comment by J Chris Anderson [ 16/Nov/11 ] |
|
A better option would be to create a generic config API access layer in Java. I think this is properly done in Ektorp, so that we don't end up shipping an HTTP client as part of the default Couchbase Mobile package. Having that HTTP client in there would invite disaster as folks would start to use it for their primary access and then we'd start to have to support it.
Chris |