私は質問がシンプルだと感じていますが、私はドキュメントや情報が一切見つからないことに驚いていました。私は単純に単一のcouchbaseデータベースのサイズを取得または計算したいだけです。あなたはどのようにcouchbaseデータベースのサイズを取得しますか
たとえば、ディーラーに車のすべての情報を格納するデータベースがあります。データベースには複数の文書があります。私はデータベースの圧縮されていない合計サイズを計算する方法を理解したいと思います。これには、データベース内のすべてのもの(添付ファイル、テキスト、すべて)が含まれます。
理想的には、Swift 3.0を使用します。しかし、どの言語でデータベースサイズを取得するかを知っていれば、言語を移植することができます。
func openDatabase() -> CBLDatabase
{
var db : CBLDatabase?
let db_name = "dealership"
let options = CBLDatabaseOptions()
options.create = true
do
{
// This will create a database if one does not exist. Otherwise, it will open it.
try db = CBLManager.sharedInstance().openDatabaseNamed(db_name, with: options)
// I would love if this was a thing! Since it is not, I would like to write a function to get the database size.
let db_size = db.getSize() // <-- This is my question. How to compute the database size.
}
catch let error as NSError
{
NSLog("Some error %@", error)
}
return db
}
/** Gets the size of the database in MB */
func getSize() -> Int
{
// What goes here?
}
Swiftを使用しているので、これはCouchbase Mobileに関するものとしますか? –