-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ydbcp): support ttl for backups
- Loading branch information
1 parent
02af8fd
commit 4197830
Showing
9 changed files
with
176 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package handlers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"go.uber.org/zap" | ||
"ydbcp/internal/config" | ||
"ydbcp/internal/connectors/db" | ||
"ydbcp/internal/connectors/db/yql/queries" | ||
"ydbcp/internal/connectors/s3" | ||
"ydbcp/internal/types" | ||
"ydbcp/internal/util/xlog" | ||
) | ||
|
||
func NewDOBOperationHandler( | ||
db db.DBConnector, | ||
s3 s3.S3Connector, | ||
config config.Config, | ||
queryBuilderFactory queries.WriteQueryBulderFactory, | ||
) types.OperationHandler { | ||
return func(ctx context.Context, op types.Operation) error { | ||
return DBOperationHandler(ctx, op, db, s3, config, queryBuilderFactory) | ||
} | ||
} | ||
|
||
func DOBOperationHandler( | ||
ctx context.Context, | ||
operation types.Operation, | ||
db db.DBConnector, | ||
s3 s3.S3Connector, | ||
config config.Config, | ||
queryBuilderFactory queries.WriteQueryBulderFactory, | ||
) error { | ||
xlog.Info(ctx, "DBOperationHandler", zap.String("OperationMessage", operation.GetMessage())) | ||
|
||
if operation.GetType() != types.OperationTypeDOB { | ||
return fmt.Errorf( | ||
"wrong type %s != %s for operation %s", | ||
operation.GetType(), types.OperationTypeDOB, types.OperationToString(operation), | ||
) | ||
} | ||
|
||
dbOp, ok := operation.(*types.DeleteOutdatedBackupsOperation) | ||
if !ok { | ||
return fmt.Errorf("can't cast operation to DeleteOutadatedBackupsOperation %s", types.OperationToString(operation)) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package handlers | ||
|
||
// TODO: add tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters