minor changes
This commit is contained in:
parent
ecbcb07854
commit
24b29cadf6
2
batch.go
2
batch.go
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ipfseth
|
package ipfsethdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ipfseth
|
package ipfsethdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -32,6 +32,7 @@ var (
|
|||||||
getPgStr = "SELECT data FROM public.blocks WHERE key = $1"
|
getPgStr = "SELECT data FROM public.blocks WHERE key = $1"
|
||||||
putPgStr = "INSERT INTO public.blocks (key, data) VALUES ($1, $2) ON CONFLICT (key) DO NOTHING"
|
putPgStr = "INSERT INTO public.blocks (key, data) VALUES ($1, $2) ON CONFLICT (key) DO NOTHING"
|
||||||
deletePgStr = "DELETE FROM public.blocks WHERE key = $1"
|
deletePgStr = "DELETE FROM public.blocks WHERE key = $1"
|
||||||
|
dbSizePgStr = "SELECT pg_database_size(current_database())"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Database struct {
|
type Database struct {
|
||||||
@ -145,9 +146,8 @@ func (d *Database) Stat(property string) (string, error) {
|
|||||||
}
|
}
|
||||||
switch prop {
|
switch prop {
|
||||||
case Size:
|
case Size:
|
||||||
pgStr := "SELECT pg_database_size(current_database())"
|
|
||||||
var byteSize string
|
var byteSize string
|
||||||
return byteSize, d.db.Get(&byteSize, pgStr)
|
return byteSize, d.db.Get(&byteSize, dbSizePgStr)
|
||||||
case Idle:
|
case Idle:
|
||||||
return string(d.db.Stats().Idle), nil
|
return string(d.db.Stats().Idle), nil
|
||||||
case InUse:
|
case InUse:
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ipfseth
|
package ipfsethdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
2
util.go
2
util.go
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ipfseth
|
package ipfsethdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ipfs/go-ipfs-blockstore"
|
"github.com/ipfs/go-ipfs-blockstore"
|
||||||
|
Loading…
Reference in New Issue
Block a user