mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge branch 'master' into translation-coordinator
This commit is contained in:
commit
51ba2492e9
2 changed files with 8 additions and 2 deletions
|
|
@ -53,8 +53,7 @@ var (
|
|||
ErrInvalidView = errors.New("invalid view")
|
||||
ErrInvalidCacheType = errors.New("invalid cache type")
|
||||
|
||||
ErrName = errors.New("invalid index or field name, must match [a-z][a-z0-9_-]* and contain at most 230 characters")
|
||||
ErrLabel = errors.New("invalid row or column label, must match [A-Za-z0-9_-]")
|
||||
ErrName = errors.New("invalid index or field name, must match [a-z][a-z0-9_-]* and contain at most 230 characters")
|
||||
|
||||
// ErrFragmentNotFound is returned when a fragment does not exist.
|
||||
ErrFragmentNotFound = errors.New("fragment not found")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package pilosa
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -24,6 +25,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var txIDRegexp = regexp.MustCompile("^[A-Za-z0-9_-]*$")
|
||||
|
||||
// Transaction contains information related to a block of work that
|
||||
// needs to be tracked and spans multiple API calls.
|
||||
type Transaction struct {
|
||||
|
|
@ -93,6 +96,10 @@ func (tm *TransactionManager) Start(ctx context.Context, id string, timeout time
|
|||
tm.mu.Lock()
|
||||
defer tm.mu.Unlock()
|
||||
|
||||
if !txIDRegexp.Match([]byte(id)) {
|
||||
return nil, errors.New("invalid transaction ID, must match [A-Za-z0-9_-]")
|
||||
}
|
||||
|
||||
trnsMap, err := tm.store.List()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "listing transactions in Start")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue