Skip to content

Commit

Permalink
Merge branch 'main' into refactor/internal-o11y/update-otel
Browse files Browse the repository at this point in the history
  • Loading branch information
kpango authored Jan 29, 2024
2 parents 895d787 + a037bd3 commit 8c3b6a4
Show file tree
Hide file tree
Showing 8 changed files with 1,330 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/update-web-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Update web contents"
on:
workflow_dispatch:
push:
branches:
- main
- "release/v*.*"
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- "**.md"
- "assets/docs/**"
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Dispatch
run: |
curl --fail -u "${USER}:${TOKEN}" \
-X POST https://api.github.com/repos/vdaas/web/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
--data '{"event_type": "update-contents"}'
env:
USER: ${{ secrets.DISPATCH_USER }}
TOKEN: ${{ secrets.DISPATCH_TOKEN }}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
github.com/akrylysov/pogreb v0.10.2 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/campoy/embedmd v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyR
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/akrylysov/pogreb v0.10.2 h1:e6PxmeyEhWyi2AKOBIJzAEi4HkiC+lKyCocRGlnDi78=
github.com/akrylysov/pogreb v0.10.2/go.mod h1:pNs6QmpQ1UlTJKDezuRWmaqkgUE2TuU0YTWyqJZ7+lI=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/stroke v0.0.0-20221221101821-bd29b49d73f0/go.mod h1:ccdDYaY5+gO+cbnQdFxEXqfy0RkoV25H3jLXUDNM3wg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
Expand Down
1 change: 1 addition & 0 deletions hack/go.mod.default
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ replace (
github.com/pkg/errors => github.com/pkg/errors upgrade
github.com/pkg/sftp => github.com/pkg/sftp upgrade
github.com/pmezard/go-difflib => github.com/pmezard/go-difflib upgrade
github.com/akrylysov/pogreb => github.com/akrylysov/pogreb upgrade
github.com/prashantv/gostub => github.com/prashantv/gostub upgrade
github.com/prometheus/client_golang => github.com/prometheus/client_golang upgrade
github.com/prometheus/client_model => github.com/prometheus/client_model upgrade
Expand Down
84 changes: 84 additions & 0 deletions internal/db/kvs/pogreb/options.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pogreb

import (
"time"

"github.com/akrylysov/pogreb"
)

var deafultOpts = []Option{
WithPath("pogreb.db"),
WithBackgroundSyncInterval("5s"),
}

// Option represents the functional option for database.
type Option func(*db) error

// WithPath returns the option to set path.
func WithPath(path string) Option {
return func(d *db) error {
if path != "" {
d.path = path
}
return nil
}
}

// WithBackgroundSyncInterval returns the option to sets the amount of time between background Sync() calls.
// Setting the value to 0 disables the automatic background synchronization.
// Setting the value to -1 or less makes the DB call Sync() after every write operation.
func WithBackgroundSyncInterval(s string) Option {
return func(d *db) error {
if s == "" {
return nil
}
dur, err := time.ParseDuration(s)
if err != nil {
return err
}
if d.opts == nil {
d.opts = new(pogreb.Options)
}
if dur < -1 {
dur = -1
}
d.opts.BackgroundSyncInterval = dur
return nil
}
}

// WithBackgroundCompactionInterval returns the option to sets the amount of time between background Compact() calls.
// Setting the value to 0 or less disables the automatic background compaction.
func WithBackgroundCompactionInterval(s string) Option {
return func(d *db) error {
if s == "" {
return nil
}
dur, err := time.ParseDuration(s)
if err != nil {
return err
}
if d.opts == nil {
d.opts = new(pogreb.Options)
}

if dur < 0 {
dur = 0
}
d.opts.BackgroundCompactionInterval = dur
return nil
}
}
Loading

0 comments on commit 8c3b6a4

Please sign in to comment.