Skip to content

Commit

Permalink
add continuous checkpointing to Datastore Features
Browse files Browse the repository at this point in the history
this helps consumer understand the behaviour of checkpoints
from the datastore without having to know which actual
datastore is it talking to.
  • Loading branch information
vroldanbet committed Sep 17, 2024
1 parent d9162eb commit 1d7caa2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/datastore/crdb/crdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,19 @@ func (cds *crdbDatastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureSupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureSupported,
},
}, nil
}

return &datastore.Features{
IntegrityData: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureSupported,
},
}, nil
}

Expand All @@ -500,7 +506,11 @@ func (cds *crdbDatastore) tableTupleName() string {
}

func (cds *crdbDatastore) features(ctx context.Context) (*datastore.Features, error) {
features := datastore.Features{}
features := datastore.Features{
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureSupported,
},
}
if cds.supportsIntegrity {
features.IntegrityData.Status = datastore.FeatureSupported
}
Expand Down
3 changes: 3 additions & 0 deletions internal/datastore/memdb/memdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ func (mdb *memdbDatastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureSupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions internal/datastore/mysql/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ func (mds *Datastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
}, nil
}

Expand Down
6 changes: 6 additions & 0 deletions internal/datastore/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ func (pgd *pgDatastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
}, nil
}

Expand All @@ -703,6 +706,9 @@ func (pgd *pgDatastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions internal/datastore/spanner/spanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ func (sd *spannerDatastore) OfflineFeatures() (*datastore.Features, error) {
IntegrityData: datastore.Feature{
Status: datastore.FeatureUnsupported,
},
ContinuousCheckpointing: datastore.Feature{
Status: datastore.FeatureSupported,
},
}, nil
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,11 @@ type Features struct {
// Watch is enabled if the underlying datastore can support the Watch api.
Watch Feature

// ContinuousCheckpointing is enabled if the underlying datastore supports continuous checkpointing
// via the Watch API. If not supported, clients of the Watch API may expect checkpoints only when
// new transactions are committed.
ContinuousCheckpointing Feature

// IntegrityData is enabled if the underlying datastore supports retrieving and storing
// integrity information.
IntegrityData Feature
Expand Down

0 comments on commit 1d7caa2

Please sign in to comment.