Discussion:
[leveldb] How to limit LevelDB maximum disk size ?
Adong Fan
2017-12-26 09:15:02 UTC
Permalink
hi all

I want to use leveldb as a local-storage-mechanism: when i send to messages
to message-queue-server fail , i will store the messages locally.

my question is :

1. how to limit the maximum disk space for levelDBotherwise it may grow
bigger and bigger ?

2. If there is no max-disk-space limit in LevelDB ? what can i do to limit
the total size in my web app ? e.g. Caculate the total num of .sst file ?
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Victor Costan' via leveldb
2017-12-29 00:02:08 UTC
Permalink
Post by Adong Fan
hi all
I want to use leveldb as a local-storage-mechanism: when i send to
messages to message-queue-server fail , i will store the messages locally.
1. how to limit the maximum disk space for levelDBotherwise it may grow
bigger and bigger ?
LevelDB does not have any support for quota right now. In Chrome, we handle
this by accounting for quota in the features built on top of LevelDB.

Here is one such implementation:
https://cs.chromium.org/chromium/src/content/browser/leveldb_wrapper_impl.h

2. If there is no max-disk-space limit in LevelDB ? what can i do to limit
Post by Adong Fan
the total size in my web app ? e.g. Caculate the total num of .sst file ?
"In my web app" is a bit vague. If you're writing JavaScript that runs in
the browser, you can use the quota API to find out your origin's data usage.

Sadly, there are 3 versions of the quota API floating around. Fortunately,
the modern API can be polyfilled on top of the older ones. The modern API
is https://developer.mozilla.org/en-US/docs/Web/API/StorageManager

I hope this helps,
Victor
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...