Do I get all revisions when polling the changes feed in Cloudant? - ibm-cloud

When using Cloudant, if I am polling the changes feed, does the result include all the revisions to every document since I last polled it?

No. If in the interval between polling the changes feed, a document is modified multiple times, then you will only get the last revision of that document. In other words, for simplicity the changes feed only gives you the last change to a document since you last polled.
There is more detail on the changes feed in this document

Related

How to get the number of commit per a year for github-api

I would like to know the number of commit per user-account in a year.
github provides the following api.
GET /repos/:owner/:repo/stats/commit_activity
But what I want is not the number of commit in the repository.
I think i can add after getting the number of commit for all the repository, but I think it's very inefficient.(Also, if the number of repertoires is large, unnecessary GET request is increased.)
Can I know the number of commit per a year for all the repositories of an user-account at just a one GET request?

KafkaStreams: forwarding only updated keys from Transformer

In my KafkaStreams app I have a registered local store (simple counters) that is updated in the transform method.
In the punctuate method I basically loop over the KV-store and push all the data to the output topic (so even if the value hasn't been updated).
One idea is to store the update timestamp for every key and forward only records updated since the last punctuate call.
But I think there should be a more convenient solution for that.
How to make this more performant and forward updated entries only?
As indicated in the comments from Matthias, keeping track of updated the records is not supported at the moment.
Your approach of updating a timestamp in the value (or creating a "Value Wrapper" object that contains a timestamp you can modify) and checking if an update has occurred since the last punctuate call is a valid approach.
-Bill

How does the .sync() function works?

I was looking at the diagram for a sync operation in Kinto docs and i have a doubt.
Why does .sync() is a pull.then(push).then(pull) instead of just pull.then(push)?
What do we need the last pull for?
When you do your push you will update the records last_modified value, so at the end you will need to grab the new last_modified value of the list.
You may also have got some changes on the collection while you were pushing your changes (done by another device).
pulling after the push will let you grab the new last_modified value, the changes that you've made as well as the changes that were made in the meantime.
At this point you might think that grabbing the changes you've made is a bit silly (because you already know what you just pushed). It is basically the subject of this issue.
The idea is that you can also try to pull with the last_modified value of your last update as a If-Match header using the last_modified value of the collection before your changes as a _since parameter and excluding all the records IDs you've changed.
In that case you will get a 304 most of the time or a list of changes that were made by others while you were doing your push.

Get timeline entry and template used for active complication?

I'd like to conditionally reload my active complication in the requestedUpdateDidBegin function or actually tell ClockKit to set the next check 15 minutes before the end of the current timeline entry, but how can I do that without knowing what's in the current complication?
Here's what I'm trying to do:
if let complications = CLKComplicationServer.sharedInstance().activeComplications {
for item in complications {
// Get timeline entry and template used?
}
}
For the current complication, I can only get the family, but no other info like timeline date or template used. Is there a way to get this?
The complication server requests data from your complication controller, but it's not designed to provide its timeline data to you. All you can find out from the server are the earliest and latest time travel dates.
You'd have to get timeline details from the original data you used to create the timeline entries in the first place.
As for scheduling your update 15 minutes before the end of the last entry, you can very easily schedule that as part of the previous reload request. The very last thing the complication server requests (after reloading or extending the timeline) is the next update date.
Since the complication server has just asked you for the future timeline entries in getTimelineEntriesForComplication:afterDate:, you can make note of the last timeline entry's date, offset it by 15 minutes, then return that new date once getNextRequestedUpdateDateWithHandler momentarily gets called.

What date is used in an Atom document's updated element?

I have an Atom document where the atom:updated element date is that of the request made to the server. Therefore it changes on each request.
My initial thoughts were that this was incorrect and would prefer to use the date of the latest published item.
So I checked the Atom documentation for atom:updated:
The "atom:updated" element is a Date construct indicating the most recent instant in time when an entry or feed was modified in a way the publisher considers significant. Therefore, not all modifications necessarily result in a changed atom:updated value.
atomUpdated = element atom:updated { atomDateConstruct }.
Publishers MAY change the value of this element over time.
I believe this backs-up my thoughts, but maybe there is a case for using the request date in certain circumstances too.
So what date is used in atom:updated?
So what date is used in atom:updated?
The specification you cite seems to answer that question:
The "atom:updated" element is a Date construct indicating the most recent instant in time when an entry or feed was modified in a way the publisher considers significant.
As a publisher, if you consider the document to be under constant significant modification then it would be compliant with the specification to return the current time.
However, it's more likely that consumers would expect that date's change to reflect specific changes.