Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@

.PHONY: deps all test full-test bin

deps:
go mod download
.PHONY: all test full-test bin

bin:
mkdir -p bin
GOBIN=${PWD}/bin go install ./exp/cmd/...
GOBIN=${PWD}/bin go install ./cmd/...

all: deps check full-test bin
all: check full-test bin

test:
go test -cover ./...
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# lmdb-go [![GitHub Release](https://img.shields.io/github/v/release/PowerDNS/lmdb-go)](https://github.com/PowerDNS/lmdb-go/releases)
[![C/v0.9.35](https://img.shields.io/badge/C-v0.9.35-555555.svg)](https://github.com/LMDB/lmdb/blob/mdb.RE/0.9/libraries/liblmdb/CHANGES) [![Build Status](https://github.com/PowerDNS/lmdb-go/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/PowerDNS/lmdb-go/actions/workflows/go.yml?query=branch%3Amaster)
# lmdb-go [![GitHub Release](https://img.shields.io/github/v/release/PowerDNS/lmdb-go)](https://github.com/PowerDNS/lmdb-go/releases) [![C/v0.9.35](https://img.shields.io/badge/C-v0.9.35-555555.svg)](https://github.com/LMDB/lmdb/blob/mdb.RE/0.9/libraries/liblmdb/CHANGES) [![Build Status](https://github.com/PowerDNS/lmdb-go/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/PowerDNS/lmdb-go/actions/workflows/go.yml?query=branch%3Amaster)

Go bindings to the OpenLDAP Lightning Memory-Mapped Database (LMDB).

Expand Down
3 changes: 1 addition & 2 deletions exp/lmdbsync/handler.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package lmdbsync

import (
"context"
"errors"
"math"
"math/rand"
"time"

"golang.org/x/net/context"

"github.com/PowerDNS/lmdb-go/lmdb"
)

Expand Down
4 changes: 1 addition & 3 deletions exp/lmdbsync/handler_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package lmdbsync

import (
"context"
"fmt"
"testing"
"time"

"golang.org/x/net/context"

"github.com/PowerDNS/lmdb-go/internal/lmdbtest"
"github.com/PowerDNS/lmdb-go/lmdb"
)
Expand Down Expand Up @@ -59,7 +58,6 @@ type passthroughHandler struct{}

func (*passthroughHandler) HandleTxnErr(ctx context.Context, env *Env, err error) (context.Context, error) {
return ctx, err

}

func TestMapFullHandler(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions exp/lmdbsync/lmdbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,12 @@ See mdb_env_open and MDB_NOLOCK.
package lmdbsync

import (
"context"
"fmt"
"os"
"sync"
"time"

"golang.org/x/net/context"

"github.com/PowerDNS/lmdb-go/lmdb"
)

Expand Down Expand Up @@ -261,6 +260,7 @@ func (r *Env) runHandler(readonly bool, fn func() error, h Handler) error {
}
}
}

func (r *Env) run(readonly bool, fn func() error) error {
var err error
if r.noLock && !readonly {
Expand Down
5 changes: 2 additions & 3 deletions exp/lmdbsync/testresize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"bufio"
"context"
"crypto/rand"
"flag"
"fmt"
Expand All @@ -26,8 +27,6 @@ import (
"os"
"time"

"golang.org/x/net/context"

"github.com/PowerDNS/lmdb-go/exp/lmdbsync"
"github.com/PowerDNS/lmdb-go/lmdb"
)
Expand Down Expand Up @@ -152,7 +151,7 @@ func OpenEnv(path string) (*lmdbsync.Env, error) {
if err != nil {
return nil, err
}
err = env.Open(path, 0, 0644)
err = env.Open(path, 0, 0o644)
if err != nil {
env.Close()
return nil, err
Expand Down
7 changes: 3 additions & 4 deletions exp/lmdbsync/testresize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lmdbsync

import (
"bufio"
"context"
"fmt"
"io"
"io/ioutil"
Expand All @@ -11,8 +12,6 @@ import (
"testing"
"time"

"golang.org/x/net/context"

"github.com/PowerDNS/lmdb-go/lmdb"
)

Expand All @@ -24,7 +23,7 @@ func TestResize(t *testing.T) {
defer os.RemoveAll(tempdir)

dbpath := filepath.Join(tempdir, "db")
err = os.Mkdir(dbpath, 0755)
err = os.Mkdir(dbpath, 0o755)
if err != nil {
t.Error(err)
return
Expand All @@ -36,7 +35,7 @@ func TestResize(t *testing.T) {
return
}
defer env.Close()
err = env.Open(dbpath, 0, 0644)
err = env.Open(dbpath, 0, 0o644)
if err != nil {
t.Error(err)
return
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/PowerDNS/lmdb-go

go 1.17

require golang.org/x/net v0.0.0-20210415231046-e915ea6b2b7d
11 changes: 0 additions & 11 deletions go.sum

This file was deleted.

2 changes: 1 addition & 1 deletion lmdb/lmdbgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* problem and the decision.
* https://github.com/golang/go/issues/14387
* https://github.com/golang/go/issues/15048
* https://github.com/PowerDNS/lmdb-go/issues/63
* https://github.com/bmatsuo/lmdb-go/issues/63
* */
int lmdbgo_mdb_del(MDB_txn *txn, MDB_dbi dbi, char *kdata, size_t kn, char *vdata, size_t vn);
int lmdbgo_mdb_get(MDB_txn *txn, MDB_dbi dbi, char *kdata, size_t kn, MDB_val *val);
Expand Down
6 changes: 4 additions & 2 deletions lmdb/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,14 @@ func (txn *Txn) Stat(dbi DBI) (*Stat, error) {
if ret != success {
return nil, operrno("mdb_stat", ret)
}
stat := Stat{PSize: uint(_stat.ms_psize),
stat := Stat{
PSize: uint(_stat.ms_psize),
Depth: uint(_stat.ms_depth),
BranchPages: uint64(_stat.ms_branch_pages),
LeafPages: uint64(_stat.ms_leaf_pages),
OverflowPages: uint64(_stat.ms_overflow_pages),
Entries: uint64(_stat.ms_entries)}
Entries: uint64(_stat.ms_entries),
}
return &stat, nil
}

Expand Down
Loading