Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Folders
_obj
_test
test-dbt-project

# IntelliJ
.idea
Expand Down
69 changes: 69 additions & 0 deletions modules/nessie/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package nessie

import (

Check failure on line 3 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gofmt)

Check failure on line 3 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gofmt)

Check failure on line 3 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gofmt)
"encoding/json"

Check failure on line 4 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-backend

import 'encoding/json' is not allowed from list 'main': use gitea's modules/json instead of encoding/json (depguard)

Check failure on line 4 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

import 'encoding/json' is not allowed from list 'main': use gitea's modules/json instead of encoding/json (depguard)

Check failure on line 4 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

import 'encoding/json' is not allowed from list 'main': use gitea's modules/json instead of encoding/json (depguard)
"fmt"
"net/http"
"time"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/log"

Check failure on line 10 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gofumpt)

Check failure on line 10 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gofumpt)

Check failure on line 10 in modules/nessie/client.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gofumpt)
)

type Reference struct {
Name string `json:"name"`
Hash string `json:"hash"`
Type string `json:"type"`
}

// ReferencesResponse represents the Nessie API response structure
type ReferencesResponse struct {
Token *string `json:"token"`
References []Reference `json:"references"`
HasMore bool `json:"hasMore"`
}

type Client struct {
baseURL string
authToken string
httpClient *http.Client
}

func NewClient() *Client {
return &Client{
baseURL: setting.Nessie.APIURL,
authToken: setting.Nessie.AuthToken,
httpClient: &http.Client{Timeout: 10 * time.Second},
}
}

func (c *Client) GetAllReferences(repo string) ([]Reference, error) {
// TODO: figure out how to handle multiple repositories
url := fmt.Sprintf("%s/api/v1/trees/", c.baseURL)

req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, fmt.Errorf("failed to create request: %v", err)
}

if c.authToken != "" {
req.Header.Set("Authorization", "Bearer "+c.authToken)
}

resp, err := c.httpClient.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to make request: %v", err)
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
}

var response ReferencesResponse
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
return nil, fmt.Errorf("failed to decode response: %v", err)
}
log.Info("Nessie references: %v", response.References)
return response.References, nil
}
23 changes: 23 additions & 0 deletions modules/setting/nessie.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package setting

import (
"code.gitea.io/gitea/modules/log"
)

Check failure on line 6 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gofmt)

Check failure on line 6 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gofmt)

Check failure on line 6 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gofmt)
var Nessie = struct {
Enabled bool
APIURL string
DefaultBranch string
AuthToken string
}{
Enabled: true,
APIURL: "http://localhost:19120",
DefaultBranch: "main",
AuthToken: "",
}

func loadNessieFrom(rootCfg ConfigProvider) {

Check failure on line 19 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-backend

func `loadNessieFrom` is unused (unused)

Check failure on line 19 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

func `loadNessieFrom` is unused (unused)

Check failure on line 19 in modules/setting/nessie.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

func `loadNessieFrom` is unused (unused)
if err := rootCfg.Section("nessie").MapTo(&Nessie); err != nil {
log.Fatal("Failed to map Nessie settings: %v", err)
}
}
71 changes: 71 additions & 0 deletions nessie-stack/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: '3.8'

services:
minio:
image: quay.io/minio/minio:latest
container_name: minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
networks:
- common_network

minio-client:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
sleep 5;
mc alias set local http://minio:9000 minioadmin minioadmin;
mc mb local/warehouse;
exit 0;
"
networks:
- common_network

nessie:
image: projectnessie/nessie:latest
container_name: nessie
ports:
- "19120:19120"
environment:
QUARKUS_HTTP_PORT: 19120
networks:
- common_network

spark-iceberg:
container_name: spark-iceberg
build: spark/
depends_on:
- nessie
- minio
volumes:
- ./warehouse:/home/iceberg/warehouse
- ./notebooks:/home/iceberg/notebooks/notebooks
environment:
- AWS_ACCESS_KEY_ID=minioadmin
- AWS_SECRET_ACCESS_KEY=minioadmin
- AWS_REGION=us-east-1
ports:
- 8888:8888
- 8080:8080
- 4040:4040
- 4041:4041
- 10000:10000
- 10001:10001
networks:
- common_network

volumes:
minio_data:

networks:
common_network:
driver: bridge
5 changes: 5 additions & 0 deletions nessie-stack/jaffle-shop-classic-spark/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export DIRENV_WARN_TIMEOUT=20s

eval "$(devenv direnvrc)"

use devenv
15 changes: 15 additions & 0 deletions nessie-stack/jaffle-shop-classic-spark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

target/
dbt_modules/
logs/
**/.DS_Store

# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions nessie-stack/jaffle-shop-classic-spark/.user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id: 22ed2a5a-1778-4431-ab2a-b546c4c3a1e4
Loading
Loading