Skip to content
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
edb1633
Update dependencies
CDRayn May 15, 2025
9cd0ced
Update S3Wrapper interface
CDRayn May 21, 2025
1cc6d11
Add methods to encryptedS3Service
CDRayn May 22, 2025
82a8cb2
Update interface
CDRayn May 23, 2025
320d2cf
Update CopyObject to use same signature of MoveObject
CDRayn May 23, 2025
61de97f
Update tests
CDRayn May 23, 2025
24a81f3
Update tests
CDRayn May 27, 2025
78e8901
Update tests
CDRayn May 28, 2025
df8cf97
Update tests
CDRayn May 28, 2025
66b398b
Update dependencies
CDRayn May 28, 2025
ce10c63
Update examples
CDRayn May 28, 2025
4e3a6c6
Update tests & remove calls to deprecated code
CDRayn May 28, 2025
cb3edcf
Update signatures
CDRayn May 28, 2025
be35bba
Update signatures in tests
CDRayn May 28, 2025
7fe6905
Update tests and examples
CDRayn May 29, 2025
de39e1d
Update test
CDRayn May 29, 2025
5f68db3
Revert gorm version
CDRayn May 29, 2025
dca02ea
run go mod tidy
CDRayn May 29, 2025
0dd078d
Updatre test
CDRayn May 29, 2025
8efc5d1
Update signatures to use s3.Options{} and kms.Options{}
CDRayn May 30, 2025
8d009ca
Update tests
CDRayn May 30, 2025
9633e57
Update tests
CDRayn May 30, 2025
f6a7b42
Fix test
CDRayn May 30, 2025
ecad0cd
Fix test
CDRayn May 30, 2025
e272f8d
Merge branch 'main' into clay/aws-go-sdk-update
CDRayn Jun 24, 2025
4e73a6c
Update ListObjects() to return contents
CDRayn Jun 24, 2025
baa224f
Update copyright notice
CDRayn Jun 24, 2025
29e1ac5
Update copyright notice
CDRayn Jun 24, 2025
9863b34
Update copyright notice
CDRayn Jun 24, 2025
1a19f18
Fix copyright notice
CDRayn Jun 24, 2025
d4a59a4
Handle error from deferred call
CDRayn Jun 24, 2025
472cbee
Provide test credentials
CDRayn Jun 25, 2025
e4c28bb
Add credential provider
CDRayn Jun 25, 2025
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
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/handlers/httphandler.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package handlers

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/handlers/httphandler_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package handlers

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/notifytypes/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package notifytypes

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"github.com/google/uuid"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/notifytypes/types_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package notifytypes

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/queuetypes/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package queuetypes

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

// WorkTypeMarkdown is queued work that renders markdown to HTML
const (
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/queuetypes/types_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package queuetypes

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"testing"
Expand Down
15 changes: 8 additions & 7 deletions examples/cmd/markdownRenderer/runners/renderer_runner.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package runners

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
Expand All @@ -20,7 +21,7 @@ import (
)

// RendererRunner is a runner is registered with the queue agent that knows how
// to render markdown text to HTML.
// to render Markdown text to HTML.
type RendererRunner struct {
queue.BaseRunner

Expand Down Expand Up @@ -74,7 +75,7 @@ func (w RendererWork) Dir() string {
return ""
}

func (r *RendererRunner) Run(work queue.RecursableWork) error {
func (r *RendererRunner) Run(ctx context.Context, work queue.RecursableWork) error {

job := &RendererWork{}
err := json.Unmarshal(work.Work, &job)
Expand All @@ -84,7 +85,7 @@ func (r *RendererRunner) Run(work queue.RecursableWork) error {

for {
// Render the markdown to HTML and "Put" it into storage.
_, _, err = r.server.Put(r.getResolverText(job), job.Dir(), job.Address())
_, _, err = r.server.Put(ctx, r.getResolverText(job), job.Dir(), job.Address())
if err != nil {
return errors.Wrap(err, "renderer_runner error")
} else {
Expand All @@ -104,7 +105,7 @@ func (r *RendererRunner) getResolverText(job *RendererWork) storagetypes.Resolve
parser.Strikethrough |
parser.SpaceHeadings |
parser.AutoHeadingIDs
parser := parser.NewWithExtensions(extensions)
p := parser.NewWithExtensions(extensions)

// Specify some helpful flags and create a renderer.
htmlFlags := html.CommonFlags | html.HrefTargetBlank
Expand All @@ -113,8 +114,8 @@ func (r *RendererRunner) getResolverText(job *RendererWork) storagetypes.Resolve

// Render the markdown and write it to storage.
normalized := markdown.NormalizeNewlines([]byte(job.Markdown))
html := markdown.ToHTML(normalized, parser, renderer)
_, err := writer.Write(html)
renderedHtml := markdown.ToHTML(normalized, p, renderer)
_, err := writer.Write(renderedHtml)
return "", "", err
}
}
15 changes: 5 additions & 10 deletions examples/cmd/markdownRenderer/runners/renderer_runner_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package runners

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"bytes"
"context"
"encoding/json"
"errors"
"testing"
Expand Down Expand Up @@ -66,9 +67,7 @@ func (s *RendererRunnerSuite) TestRunUnmarshalError(c *check.C) {
server := &rsstorage.DummyStorageServer{}
r := NewRendererRunner(server)
bWork := []byte("bad")
err := r.Run(queue.RecursableWork{
Work: bWork,
})
err := r.Run(context.Background(), queue.RecursableWork{Work: bWork})
c.Check(err, check.ErrorMatches, "invalid character 'b' looking for beginning of value")
}

Expand All @@ -81,9 +80,7 @@ func (s *RendererRunnerSuite) TestRunCacheError(c *check.C) {
c.Assert(err, check.IsNil)
bWork, err := json.Marshal(w)
c.Assert(err, check.IsNil)
err = r.Run(queue.RecursableWork{
Work: bWork,
})
err = r.Run(context.Background(), queue.RecursableWork{Work: bWork})
c.Check(err, check.ErrorMatches, `renderer_runner error: cache error`)
}

Expand All @@ -94,9 +91,7 @@ func (s *RendererRunnerSuite) TestRunOk(c *check.C) {
c.Assert(err, check.IsNil)
bWork, err := json.Marshal(w)
c.Assert(err, check.IsNil)
err = r.Run(queue.RecursableWork{
Work: bWork,
})
err = r.Run(context.Background(), queue.RecursableWork{Work: bWork})
c.Check(err, check.IsNil)
c.Check(server.PutCalled, check.Equals, 1)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/storage/chunks.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package storage

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"time"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/storage/chunks_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package storage

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"errors"
Expand Down
16 changes: 11 additions & 5 deletions examples/cmd/markdownRenderer/store/queue.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package store

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"database/sql"
Expand Down Expand Up @@ -198,7 +198,7 @@ func QueueUpdateGroup(conn *gorm.DB, group *QueueGroup) (dbqueuetypes.QueueGroup

func (conn *store) QueueGroupComplete(id int64) (done bool, cancelled bool, err error) {
var count int64
conn.db.Transaction(func(tx *gorm.DB) error {
err = conn.db.Transaction(func(tx *gorm.DB) error {
err = tx.Model(&Queue{}).Where("group_id = ?", id).Count(&count).Error
if err != nil {
return err
Expand All @@ -218,6 +218,9 @@ func (conn *store) QueueGroupComplete(id int64) (done bool, cancelled bool, err
}
return err
})
if err != nil {
return false, false, err
}

return count == 0, cancelled, err
}
Expand All @@ -232,7 +235,7 @@ func (conn *store) IsQueueAddressComplete(address string) (done bool, err error)
// testing with a special locking connection.
var count int64
var workErr error
conn.db.Transaction(func(tx *gorm.DB) error {
err = conn.db.Transaction(func(tx *gorm.DB) error {
err = tx.Model(&Queue{}).Where("address = ?", address).Count(&count).Error
if err != nil {
return err
Expand All @@ -244,6 +247,9 @@ func (conn *store) IsQueueAddressComplete(address string) (done bool, err error)
workErr = c2.QueueAddressedCheck(address)
return nil
})
if err != nil {
return false, err
}

if workErr != nil {
err = workErr
Expand Down Expand Up @@ -507,7 +513,7 @@ func (conn *store) QueuePop(name string, maxPriority uint64, types []uint64) (*q
types = append(types, queuetypes.TYPE_NONE)
}

// Important: we do this SELECT outside of the transaction to help avoid "database is locked" errors.
// Important: we do this SELECT outside the transaction to help avoid "database is locked" errors.
// Since SQLite WAL allows us to read during writes, we can do quick read-only check to see if any
// work is available in the queue before even starting a transaction or requesting a queue permit.
//
Expand Down Expand Up @@ -539,7 +545,7 @@ func (conn *store) QueuePop(name string, maxPriority uint64, types []uint64) (*q
// Get work item
result.Work, result.Address, result.WorkType, result.Carrier, err = getWork(tx, pt.ID)
result.Permit = pt.PermitId()
if err == gorm.ErrRecordNotFound {
if errors.Is(gorm.ErrRecordNotFound, err) {
return err
} else if err != nil {
return fmt.Errorf("Error getting claimed queue work: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/markdownRenderer/store/queue_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package store

// Copyright (C) 2022 by RStudio, PBC
// Copyright (C) 2025 by Posit Software, PBC

import (
"database/sql"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/cmd/debug.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/cmd/log.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"log"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/cmd/log_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"log"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testlog/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testnotify/cmd/notify.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testnotify/cmd/notify_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testnotify/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testnotify/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"log"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testnotify/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testservice/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion examples/cmd/testservice/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// Copyright (C) 2022 by RStudio, PBC.
// Copyright (C) 2025 by Posit Software, PBC.

import (
"testing"
Expand Down
Loading
Loading