Skip to content

Commit d7bcf81

Browse files
committed
[*] rename the project to pg_etcd
1 parent 89cdc0d commit d7bcf81

File tree

13 files changed

+40
-48
lines changed

13 files changed

+40
-48
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# GitHub Copilot Instructions: etcd_fdw Single Package Architecture
1+
# GitHub Copilot Instructions: pg_etcd Single Package Architecture
22

33
## Project Context
44

5-
**Tool**: etcd_fdw - Bidirectional synchronization between etcd and PostgreSQL
5+
**Tool**: pg_etcd - Bidirectional synchronization between etcd and PostgreSQL
66
**Language**: Go 1.25
77
**Architecture**: Single package consolidation (refactoring from separate internal/etcd and internal/db packages)
88
**Database**: PostgreSQL with single `etcd` table using revision status encoding

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cache-dependency-path: 'go.sum'
3434

3535
- name: Build
36-
run: go build ./cmd/etcd_fdw
36+
run: go build ./cmd/pg_etcd
3737

3838
- name: GolangCI-Lint
3939
uses: golangci/golangci-lint-action@v8

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
builds:
4-
- main: ./cmd/etcd_fdw
4+
- main: ./cmd/pg_etcd
55
env:
66
- CGO_ENABLED=0
77
goos:

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# etcd_fdw Makefile
1+
# pg_etcd Makefile
22

33
.PHONY: build test lint clean install help
44

55
# Build variables
6-
BINARY_NAME=etcd_fdw
6+
BINARY_NAME=pg_etcd
77
VERSION?=dev
88
BUILD_DIR=.
99
LDFLAGS=-ldflags="-X main.version=$(VERSION)"
@@ -15,7 +15,7 @@ LDFLAGS=-ldflags="-X main.version=$(VERSION)"
1515
build:
1616
@echo "Building $(BINARY_NAME)..."
1717
@mkdir -p $(BUILD_DIR)
18-
@go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/etcd_fdw
18+
@go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/pg_etcd
1919

2020
## Run tests
2121
test:
@@ -51,11 +51,11 @@ check: test lint
5151
build-all:
5252
@echo "Building for multiple platforms..."
5353
@mkdir -p $(BUILD_DIR)
54-
@GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/etcd_fdw
55-
@GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/etcd_fdw
56-
@GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/etcd_fdw
57-
@GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/etcd_fdw
58-
@GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/etcd_fdw
54+
@GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/pg_etcd
55+
@GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/pg_etcd
56+
@GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/pg_etcd
57+
@GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/pg_etcd
58+
@GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/pg_etcd
5959

6060
## Run the binary (requires PostgreSQL and etcd)
6161
run: build

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[![Coverage Status](https://coveralls.io/repos/github/cybertec-postgresql/etcd_fdw/badge.svg)](https://coveralls.io/github/cybertec-postgresql/etcd_fdw)
22

3-
# etcd_fdw - Bidirectional Synchronization
3+
# pg_etcd - Bidirectional Synchronization
44

55
## Overview
66

7-
etcd_fdw provides bidirectional synchronization between etcd and PostgreSQL using a single table architecture with revision status encoding.
7+
pg_etcd provides bidirectional synchronization between etcd and PostgreSQL using a single table architecture with revision status encoding.
88

99
## Architecture
1010

@@ -15,15 +15,15 @@ etcd_fdw provides bidirectional synchronization between etcd and PostgreSQL usin
1515
## Installation
1616

1717
```bash
18-
go install github.com/cybertec-postgresql/etcd_fdw/cmd/etcd_fdw@latest
18+
go install github.com/cybertec-postgresql/pg_etcd/cmd/pg_etcd@latest
1919
```
2020

2121
## Usage
2222

2323
```bash
2424
# Basic usage
25-
etcd_fdw --postgres-dsn="postgres://user:pass@localhost/db" --etcd-dsn="etcd://localhost:2379/prefix"
25+
pg_etcd --postgres-dsn="postgres://user:pass@localhost/db" --etcd-dsn="etcd://localhost:2379/prefix"
2626

2727
# With custom polling interval
28-
etcd_fdw --postgres-dsn="..." --etcd-dsn="..." --polling-interval=2s
28+
pg_etcd --postgres-dsn="..." --etcd-dsn="..." --polling-interval=2s
2929
```

cmd/etcd_fdw/cli_test.go renamed to cmd/pg_etcd/cli_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package main provides CLI testing for etcd_fdw command-line interface.
1+
// Package main provides CLI testing for pg_etcd command-line interface.
22
package main
33

44
import (
@@ -8,7 +8,7 @@ import (
88
"github.com/stretchr/testify/require"
99
)
1010

11-
// TestCLIParsing tests DSN parsing and flag validation for etcd_fdw CLI
11+
// TestCLIParsing tests DSN parsing and flag validation for pg_etcd CLI
1212
// This test MUST FAIL until CLI implementation is complete (TDD approach)
1313
func TestCLIParsing(t *testing.T) {
1414
tests := []struct {
@@ -124,8 +124,8 @@ func TestCLIParsing(t *testing.T) {
124124
// TestCLIEnvironmentVariables tests that CLI can read from environment variables
125125
func TestCLIEnvironmentVariables(t *testing.T) {
126126
// Set environment variables
127-
t.Setenv("ETCD_FDW_POSTGRES_DSN", "postgres://env:pass@localhost:5432/envdb")
128-
t.Setenv("ETCD_FDW_ETCD_DSN", "etcd://localhost:2379,localhost:2380/")
127+
t.Setenv("pg_etcd_POSTGRES_DSN", "postgres://env:pass@localhost:5432/envdb")
128+
t.Setenv("pg_etcd_ETCD_DSN", "etcd://localhost:2379,localhost:2380/")
129129

130130
// This will fail because ParseCLI function doesn't exist yet
131131
config, err := ParseCLI([]string{})
@@ -139,8 +139,8 @@ func TestCLIEnvironmentVariables(t *testing.T) {
139139
// TestCLIFlagPrecedence tests that command-line flags override environment variables
140140
func TestCLIFlagPrecedence(t *testing.T) {
141141
// Set environment variables
142-
t.Setenv("ETCD_FDW_POSTGRES_DSN", "postgres://env:pass@localhost:5432/envdb")
143-
t.Setenv("ETCD_FDW_ETCD_DSN", "etcd://localhost:2379/")
142+
t.Setenv("pg_etcd_POSTGRES_DSN", "postgres://env:pass@localhost:5432/envdb")
143+
t.Setenv("pg_etcd_ETCD_DSN", "etcd://localhost:2379/")
144144

145145
// Command-line flags should override environment
146146
args := []string{

cmd/etcd_fdw/main.go renamed to cmd/pg_etcd/main.go

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package main implements the etcd_fdw binary for bidirectional synchronization
1+
// Package main implements the pg_etcd binary for bidirectional synchronization
22
// between etcd and PostgreSQL.
33
package main
44

@@ -13,18 +13,17 @@ import (
1313
"github.com/jessevdk/go-flags"
1414
"github.com/sirupsen/logrus"
1515

16-
"github.com/cybertec-postgresql/etcd_fdw/internal/log"
17-
"github.com/cybertec-postgresql/etcd_fdw/internal/sync"
16+
"github.com/cybertec-postgresql/pg_etcd/internal/log"
17+
"github.com/cybertec-postgresql/pg_etcd/internal/sync"
1818
)
1919

2020
// Config holds the application configuration
2121
type Config struct {
22-
PostgresDSN string `short:"p" env:"ETCD_FDW_POSTGRES_DSN" long:"postgres-dsn" description:"PostgreSQL connection string"`
23-
EtcdDSN string `short:"e" env:"ETCD_FDW_ETCD_DSN" long:"etcd-dsn" description:"etcd connection string"`
24-
LogLevel string `short:"l" env:"ETCD_FDW_LOG_LEVEL" long:"log-level" description:"Log level: debug|info|warn|error" default:"info"`
22+
PostgresDSN string `short:"p" env:"pg_etcd_POSTGRES_DSN" long:"postgres-dsn" description:"PostgreSQL connection string"`
23+
EtcdDSN string `short:"e" env:"pg_etcd_ETCD_DSN" long:"etcd-dsn" description:"etcd connection string"`
24+
LogLevel string `short:"l" env:"pg_etcd_LOG_LEVEL" long:"log-level" description:"Log level: debug|info|warn|error" default:"info"`
2525
PollingInterval string `long:"polling-interval" description:"Polling interval for PostgreSQL to etcd sync" default:"1s"`
2626
Version bool `short:"v" long:"version" description:"Show version information"`
27-
Help bool
2827
}
2928

3029
var (
@@ -36,27 +35,20 @@ var (
3635
// ParseCLI parses command-line arguments and returns the configuration
3736
func ParseCLI(args []string) (cmdOpts *Config, err error) {
3837
cmdOpts = new(Config)
39-
parser := flags.NewParser(cmdOpts, flags.HelpFlag)
40-
parser.SubcommandsOptional = true // if not command specified, start monitoring
41-
nonParsedArgs, err := parser.ParseArgs(args) // parse and execute subcommand if any
38+
parser := flags.NewParser(cmdOpts, flags.Default)
39+
_, err = parser.ParseArgs(args) // parse and execute subcommand if any
4240
if err != nil {
43-
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
44-
cmdOpts.Help = true
45-
}
4641
if !flags.WroteHelp(err) {
4742
parser.WriteHelp(os.Stdout)
4843
}
4944
return cmdOpts, err
5045
}
51-
if len(nonParsedArgs) > 0 { // we don't expect any non-parsed arguments
52-
return cmdOpts, fmt.Errorf("unknown argument(s): %v", nonParsedArgs)
53-
}
5446
return
5547
}
5648

5749
// ShowVersion prints version information and exits
5850
func ShowVersion() {
59-
fmt.Printf("etcd_fdw version %s\n", version)
51+
fmt.Printf("pg_etcd version %s\n", version)
6052
if commit != "none" && commit != "" {
6153
fmt.Printf("commit: %s\n", commit)
6254
}
@@ -85,7 +77,7 @@ func SetupLogging(logLevel string) error {
8577
"version": version,
8678
"commit": commit,
8779
"pid": os.Getpid(),
88-
}).Info("etcd_fdw logging initialized")
80+
}).Info("pg_etcd logging initialized")
8981

9082
return nil
9183
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/cybertec-postgresql/etcd_fdw
1+
module github.com/cybertec-postgresql/pg_etcd
22

33
go 1.25
44

internal/migrations/migrations.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package migrations contains database migration definitions and functionality for etcd_fdw.
1+
// Package migrations contains database migration definitions and functionality for pg_etcd.
22
package migrations
33

44
import (
@@ -47,7 +47,7 @@ func getMigrator() (*migrator.Migrator, error) {
4747
once.Do(func() {
4848
migratorInstance, err = migrator.New(
4949
migrations(),
50-
migrator.TableName("etcd_fdw_migrations"),
50+
migrator.TableName("pg_etcd_migrations"),
5151
)
5252
})
5353
return migratorInstance, err

internal/migrations/migrations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package migrations provides migration testing for etcd_fdw database migrations.
1+
// Package migrations provides migration testing for pg_etcd database migrations.
22
package migrations
33

44
import (

0 commit comments

Comments
 (0)