Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

adds support for timestamp#16

Merged
brunocalza merged 6 commits intomainfrom
bcalza/timestamp
Nov 14, 2023
Merged

adds support for timestamp#16
brunocalza merged 6 commits intomainfrom
bcalza/timestamp

Conversation

@brunocalza
Copy link
Contributor

@brunocalza brunocalza commented Nov 9, 2023

High-level changes:

  • the upload command now accepts a --timestamp flag. You can pass an integer (assumes to be epoch in seconds), a date (e.g. 2006-01-02) or a datetime with timezone (e.g. 2006-01-02T15:04:05Z07:00)

  • the deals command now accepts --before, --after , and --at flags to filter deals by timestamp

    # examples
    basin publication deals --publication demotest.data --at 1699569502
    basin publication deals --publication demotest.data --before 2023-11-09T19:38:23-03:00
    basin publication deals --publication demotest.data --after 2023-11-09  

That info is sent to the provider. See: tablelandnetwork/basin-provider#13

- in file uploads
- and listing files

Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
return false, nil
}

func validateBeforeAndAfter(before, after, at string) (app.Timestamp, app.Timestamp, error) {
Copy link
Contributor Author

@brunocalza brunocalza Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic is, if at is not empty, before and after will be set to at (and the previous values of before and after will be ignored). that simplifies a bit, so we only need two variables to implement range and equality queries

Destination: &secure,
Value: true,
},
&cli.Int64Flag{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adds the timestamp flag to upload command, with default to UTC in seconds

@brunocalza brunocalza self-assigned this Nov 9, 2023
Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
@brunocalza brunocalza marked this pull request as ready for review November 9, 2023 22:20
Copy link
Contributor

@sanderpick sanderpick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

},
&cli.StringFlag{
Name: "timestamp",
Usage: "The time the file was created",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we explain here that the default is "now" according to client time? or is that obvious in the help output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah not very obvious. i can add more info. but it's actually the "now" according to UTC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool. i meant "now" as UTC according to client's clock, but maybe that's obvious

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny, didn't realize the help would show the calculated value

OPTIONS:
   --private-key value  Ethereum wallet private key
   --name value         Publication name
   --secure             Uses TLS connection (default: true)
   --timestamp value    The time the file was created (default: "1699641318")
   --help, -h           show help

quite weird because every time you run, shows a different value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, that is funny. maybe okay if you just saying something like "The time the file was created (defaults to now UTC)

Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
},
&cli.StringFlag{
Name: "timestamp",
Usage: "The time the file was created (default: current epoch in UTC)",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanderpick did this change and the default is here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay perfect

Signed-off-by: Bruno Calza <brunoangelicalza@gmail.com>
@brunocalza brunocalza merged commit 6c7ede1 into main Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants