Skip to content

Commit

Permalink
Merge pull request #15 from wojas/github-actions-ci
Browse files Browse the repository at this point in the history
CI: switch to Github Actions
  • Loading branch information
wojas authored Sep 14, 2023
2 parents 81e585c + faf966b commit 90e366b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 35 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:

build:
runs-on: ubuntu-22.04
strategy:
matrix:
go:
- '1.19'
- '1.20'
- '1.21'
- '1.x'

name: Go ${{ matrix.go }} tests
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Install golint
run: go install golang.org/x/lint/golint@latest
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Build and test
run: make all

11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions exp/lmdbsync/lmdbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Bypassing an Env's methods to access the underlying lmdb.Env is not safe. The
severity of such usage depends such behavior should be strictly avoided as it
may produce undefined behavior from the LMDB C library.
Resizing the environment
# Resizing the environment
The Env type synchronizes all calls to Env.SetMapSize so that it may, with some
caveats, be safely called in the presence of concurrent transactions after an
Expand Down Expand Up @@ -65,7 +65,7 @@ not OS X).
See mdb_env_set_mapsize.
MapFull
# MapFull
The MapFullHandler function configures an Env to automatically call increase
the map size with Env.SetMapSize and retry transactions when a lmdb.MapFull
Expand All @@ -77,7 +77,7 @@ and do not cause unwanted additive change to the program state.
See mdb_txn_commit and MDB_MAP_FULL.
MapResized
# MapResized
When multiple processes access and resize an environment it is not uncommon to
encounter a MapResized error which prevents the TxnOp from being executed and
Expand All @@ -90,7 +90,7 @@ TxnOp.
See mdb_txn_begin and MDB_MAP_RESIZED.
NoLock
# NoLock
When the lmdb.NoLock flag is set on an environment Env handles all transaction
synchronization using Go structures and is an experimental feature. It is
Expand Down
8 changes: 4 additions & 4 deletions lmdb/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ const (
// Most often helper functions such as IsNotFound may be used instead of
// dealing with Errno values directly.
//
// lmdb.IsNotFound(err)
// lmdb.IsErrno(err, lmdb.TxnFull)
// lmdb.IsErrnoSys(err, syscall.EINVAL)
// lmdb.IsErrnoFn(err, os.IsPermission)
// lmdb.IsNotFound(err)
// lmdb.IsErrno(err, lmdb.TxnFull)
// lmdb.IsErrnoSys(err, syscall.EINVAL)
// lmdb.IsErrnoFn(err, os.IsPermission)
type Errno C.int

// minimum and maximum values produced for the Errno type. syscall.Errnos of
Expand Down
1 change: 1 addition & 0 deletions lmdb/error_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package lmdb
Expand Down
12 changes: 4 additions & 8 deletions lmdb/lmdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ reference.
http://www.lmdb.tech/doc/starting.html
http://www.lmdb.tech/doc/modules.html
Environment
# Environment
An LMDB environment holds named databases (key-value stores). An environment
is represented as one file on the filesystem (though often a corresponding lock
Expand All @@ -25,8 +24,7 @@ Note that the package lmdb forces all Env objects to be opened with the NoTLS
(in the author's opinion). However, even for environments opened with this
flag there are caveats regarding how transactions are used (see Caveats below).
Databases
# Databases
A database in an LMDB environment is an ordered key-value store that holds
arbitrary binary data. Typically the keys are unique but duplicate keys may be
Expand All @@ -43,8 +41,7 @@ closed but it is not required. Typically, applications acquire handles for all
their databases immediately after opening an environment and retain them for
the lifetime of the process.
Transactions
# Transactions
View (readonly) transactions in LMDB operate on a snapshot of the database at
the time the transaction began. The number of simultaneously active view
Expand Down Expand Up @@ -108,8 +105,7 @@ uses a finalizer to abort unreachable Txn objects. But of course, applications
must still be careful not to leak unterminated Txn objects in a way such that
they fail get garbage collected.
Caveats
# Caveats
Write transactions (those created without the Readonly flag) must be created in
a goroutine that has been locked to its thread by calling the function
Expand Down
2 changes: 1 addition & 1 deletion lmdb/msgfunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type msgfunc func(string) error
// not contain pointers in their struct fields. See the following language
// proposal which discusses the restrictions on passing pointers to C.
//
// https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md
// https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md
type msgctx uintptr
type _msgctx struct {
fn msgfunc
Expand Down
13 changes: 6 additions & 7 deletions lmdb/val.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
// source file malloc.go and the compiler typecheck.go for more information
// about memory limits and array bound limits.
//
// https://github.com/golang/go/blob/a03bdc3e6bea34abd5077205371e6fb9ef354481/src/runtime/malloc.go#L151-L164
// https://github.com/golang/go/blob/36a80c5941ec36d9c44d6f3c068d13201e023b5f/src/cmd/compile/internal/gc/typecheck.go#L383
// https://github.com/golang/go/blob/a03bdc3e6bea34abd5077205371e6fb9ef354481/src/runtime/malloc.go#L151-L164
// https://github.com/golang/go/blob/36a80c5941ec36d9c44d6f3c068d13201e023b5f/src/cmd/compile/internal/gc/typecheck.go#L383
//
// On 64-bit systems, luckily, the value 2^32-1 coincides with the maximum data
// size for LMDB (MAXDATASIZE).
Expand All @@ -42,9 +42,9 @@ type Multi struct {
// WrapMulti converts a page of contiguous values with stride size into a
// Multi. WrapMulti panics if len(page) is not a multiple of stride.
//
// _, val, _ := cursor.Get(nil, nil, lmdb.FirstDup)
// _, page, _ := cursor.Get(nil, nil, lmdb.GetMultiple)
// multi := lmdb.WrapMulti(page, len(val))
// _, val, _ := cursor.Get(nil, nil, lmdb.FirstDup)
// _, page, _ := cursor.Get(nil, nil, lmdb.GetMultiple)
// multi := lmdb.WrapMulti(page, len(val))
//
// See mdb_cursor_get and MDB_GET_MULTIPLE.
func WrapMulti(page []byte, stride int) *Multi {
Expand Down Expand Up @@ -83,8 +83,7 @@ func (m *Multi) Stride() int {

// Size returns the total size of the Multi data and is equal to
//
// m.Len()*m.Stride()
//
// m.Len()*m.Stride()
func (m *Multi) Size() int {
return len(m.page)
}
Expand Down

0 comments on commit 90e366b

Please sign in to comment.