Skip to content

Commit

Permalink
postgres: add postgres format docs, refactoing postgres flavours
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Safonov committed Sep 2, 2022
1 parent 9f5036a commit 08eb303
Show file tree
Hide file tree
Showing 7 changed files with 305 additions and 9 deletions.
283 changes: 283 additions & 0 deletions doc/postgres.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ const (
OPUS_PACKET = "opus_packet"
PCAP = "pcap"
PCAPNG = "pcapng"
PGWAL = "pgwal"
PGWALPAGE = "pgwal_page"
PGMULTIXACTOFF = "pgmultixact_offsets"
PGMULTIXACTMEM = "pgmultixact_members"
PG_WAL = "pg_wal"
PG_WALPAGE = "pg_wal_page"
PG_MULTIXACTOFF = "pg_multixact_offsets"
PG_MULTIXACTMEM = "pg_multixact_members"
PG_CONTROL = "pg_control"
PGHEAP = "pgheap"
PG_HEAP = "pg_heap"
PNG = "png"
PRORES_FRAME = "prores_frame"
PROTOBUF = "protobuf"
Expand Down
1 change: 1 addition & 0 deletions format/postgres/pg_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func probeForDecode(d *decode.D, in any) any {
d.U64()
pgControlVersion := d.U32()

// try to guess version
switch pgControlVersion {
case PG_CONTROL_VERSION_11:
return postgres11.DecodePgControl(d, in)
Expand Down
5 changes: 4 additions & 1 deletion format/postgres/pgheap.go → format/postgres/pg_heap.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import (
"github.com/wader/fq/pkg/interp"
)

// TO DO
// oom kill on 1 GB file

func init() {
interp.RegisterFormat(decode.Format{
Name: format.PGHEAP,
Name: format.PG_HEAP,
Description: "PostgreSQL heap file",
DecodeFn: decodePgheap,
DecodeInArg: format.PostgresIn{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import (
"github.com/wader/fq/pkg/scalar"
)

// TO DO
// actualize

const BLCKSZ = 8192

func init() {
interp.RegisterFormat(decode.Format{
Name: format.PGMULTIXACTOFF,
Name: format.PG_MULTIXACTOFF,
Description: "PostgreSQL multixact offset file",
DecodeFn: mxOffsetDecode,
})
interp.RegisterFormat(decode.Format{
Name: format.PGMULTIXACTMEM,
Name: format.PG_MULTIXACTMEM,
Description: "PostgreSQL multixact members file",
DecodeFn: mxMembersDecode,
})
Expand Down
5 changes: 4 additions & 1 deletion format/postgres/pgwal.go → format/postgres/pg_wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import (
"github.com/wader/fq/pkg/interp"
)

// TO DO
// not ready yet

func init() {
interp.RegisterFormat(decode.Format{
Name: format.PGWAL,
Name: format.PG_WAL,
Description: "PostgreSQL write-ahead log file",
DecodeFn: decodePgwal,
DecodeInArg: format.PostgresIn{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package postgres

// TO DO
// remove

//import (
// "github.com/wader/fq/format"
// "github.com/wader/fq/pkg/decode"
Expand Down

0 comments on commit 08eb303

Please sign in to comment.