Skip to content

rest: API for pending devices and folders. - #498

Merged
calmh merged 15 commits into
syncthing:mainfrom
acolomb:rest-api-for-pending-stuff
Jan 11, 2021
Merged

calmh merged 15 commits into
syncthing:mainfrom
acolomb:rest-api-for-pending-stuff

Conversation

@acolomb

@acolomb acolomb commented Mar 18, 2020 •

Copy link
Copy Markdown
Member

Basically mirror the information that currently lives within the GET
/rest/system/config endpoint, using two new endpoints under
/rest/system.

Note that for pendingFolders, the structure is inverted: In the
config, they live underneath the "devices" tree, here the offering
devices are listed underneath the pendingFolders entry with the same
information.

Include some example content (totally made up for now as there is no
implementation yet
).

Basically mirror the information that currently lives within the GET
/rest/system/config endpoint, using two new endpoints under
/rest/system.

Note that for pendingFolders, the structure is inverted: In the
config, they live underneath the "devices" tree, here the offering
devices are listed underneath the pendingFolders entry with the same
information.

Include some example content (totally made up for now as there is no
implementation yet).
@acolomb

acolomb commented Mar 18, 2020

Copy link
Copy Markdown
Member Author

As discussed in syncthing/syncthing#5758, this is a first step and RFC to agree on the API.

@imsodin

imsodin commented Mar 18, 2020

Copy link
Copy Markdown
Member

Looks sensible to me, except that wrapping the entire thing into a dict with a single key named after the endpoint feels redundant, I'd just return the contents.

@acolomb

acolomb commented Mar 19, 2020

Copy link
Copy Markdown
Member Author

That was inspired by looking at some other endpoint responses. It makes it easier to add other / meta information at a later time, for example a "totals" section like in /rest/system/connections.

However, I'm open to changing it in the name of the KISS principle, sacrificing hypothetical extensibility. If that is the preferred consensus...

@AudriusButkevicius

Copy link
Copy Markdown
Member

Connections is a bad example. Dics should not be used for anything else than a single object.

We probably also want endpoints to mutate these.

@acolomb

acolomb commented Mar 19, 2020 •

Copy link
Copy Markdown
Member Author

@AudriusButkevicius Good idea actually. Noted on my to-do list, but I'll focus on the database stuff first. In a first step, adding them to the config like the GUI currently will still work and not require any changes that would be moot after moving to a separate endpoint.

Do you have a concrete idea what these mutating requests should look like?

Return the array of objects directly without wrapping in another
object.
@acolomb

acolomb commented Mar 19, 2020

Copy link
Copy Markdown
Member Author

For the pendingDevices endpoint, it was suggested to live as just another property within the GET /rest/system/connections endpoint response. Would anyone favor that approach?

In my opinion the /rest/system/* structure is proliferating. If we're already introducing new stuff here, should we consider a different second-level path for this, e.g. /rest/cluster/*? discovery and connections would fit there as well, long-term.

@acolomb

acolomb commented Mar 19, 2020

Copy link
Copy Markdown
Member Author

See also #499 for the next evolutionary step concerning suggested candidate devices.

@acolomb

acolomb commented Mar 19, 2020

Copy link
Copy Markdown
Member Author

Connections is a bad example. Dics should not be used for anything else than a single object.

The GET /rest/system/error endpoint also follows that pattern by the way.

@AudriusButkevicius

Copy link
Copy Markdown
Member

Yes, and some old crufty file exploration endpoints.

@acolomb acolomb changed the title Draft REST API for pending devices and folders. rest: Draft API for pending devices and folders. Mar 22, 2020
Mirror the current draft implementation.  Add a new subsection in the
Development TOC, with a very short description.

Add FIXME about the version when these endpoints were added, TBD.
acolomb added 2 commits June 5, 2020 00:37
Applies to pendingdevices (by device ID), pendingfolders (by folder
ID) and therein to the offeredBy enumeration (by device ID).
@acolomb

acolomb commented Jun 13, 2020

Copy link
Copy Markdown
Member Author

As suggested by @calmh here, the entries are now returned as object attributes with the device / folder ID as key.

The offering devices for a pending folder are still contained in a lone offeredBy object attribute. Should that be skipped as well? I think the structure is easier to understand this way.

Kindly requesting feedback before implementing the change in the actual code PR.

Based on what the current draft implementation actually responds.
@calmh calmh closed this Jun 15, 2020
@calmh calmh reopened this Jun 15, 2020
@calmh
calmh changed the base branch from master to main June 15, 2020 20:26
@st-review

Copy link
Copy Markdown

🤖 beep boop

I'm going to close this pull request as it has been idle for more than 90 days.

This is not a rejection, merely a removal from the list of active pull requests that is periodically reviewed by humans. The pull request can be reopened when there is new activity, and merged once any remaining issues are resolved.

@st-review st-review closed this Sep 14, 2020
When the device parameter is given, unrelated pending folders are
ommitted completely.  For the ones involving the given device,
possible other offering devices are ommitted as well, so mention that
explicitly.
@acolomb acolomb reopened this Nov 15, 2020
@acolomb
acolomb marked this pull request as ready for review December 2, 2020 23:14

@imsodin imsodin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for also taking care of the docs!

Comment thread dev/rest.rst Resolved
Comment thread rest/cluster-pending-devices-get.rst Resolved
Comment thread dev/rest.rst
Cluster Endpoints
-----------------

Concerns the mesh network structure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does "mesh" add anything to "network structure"? Seems redundant to me. And all the other subtopics don't have an explanation, maybe remove this entirely making this entire section just a plain, compact listing of endpoints.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think an explanation for each group would be magnificent, but we can remove this one if it stands out. Do you think the other groups could be explained in a similar manner?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think all the other endpoints are more or less self-explanatory. At least adding something like "Query information from database" wouldn't add much to "Database Endpoints". "Cluster Endpoints" is a bit special in that respect, as I don't think it's immediately obvious what is meant by "Cluster". So lets keep the explanation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In that case, I find the "mesh network" appropriate. It's a separate class of networks and an established technical term AFAIK.

Comment thread rest/system-config-get.rst Outdated
Comment on lines +6 to +7
instead. Also note that the ``pendingFolders`` and ``pendingDevices``
fields have been removed as of v1.FIXME.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wouldn't start documenting individual changes to the config. We didn't do that until now and I don't see us (consequently) doing it in the future. Having just a few mentioned might confuse and/or create wrong assumptions that it is documented. And having them in the config is not an error.

I just wanted to say that there should however be a deprecation note in users/config.rst, however the pending elements were never documented there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So what do we do about the examples? Just remove the corresponding lines?

Is there an easy way to browse older versions of the deployed documentation? Like we know it from readthedocs for example.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd just remove them.

Good question. I remember discussing that, probably when talking about alternative ways to organize/edit documentation. I don't think there's any way to select past version currently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There are the previews for every checked commit in a PR, but they vanish after some time. Maybe the same mechanism could be used to deploy to a permanent location for each tag?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd just remove them.

Done.

@acolomb acolomb changed the title rest: Draft API for pending devices and folders. rest: API for pending devices and folders. Dec 17, 2020
@acolomb

acolomb commented Dec 17, 2020

Copy link
Copy Markdown
Member Author

Is this okay to merge, now that the implementation landed in main? Probably good for wrapper developers to start early.

@calmh
calmh merged commit 3e054f6 into syncthing:main Jan 11, 2021
@acolomb
acolomb deleted the rest-api-for-pending-stuff branch January 11, 2021 15:58
calmh added a commit that referenced this pull request Mar 9, 2021
* main: (21 commits)
  Remove dead Badger experiment
  users/config: Describe QUIC address config (#618)
  Mention QUIC related port (#617)
  dev/release-creation: Adjust to changes to grt tool
  dev/building: Update go version to 1.16 (#614)
  dev/building: Add Windows and Android prerequisite information (#615)
  Update versioning.rst (#613)
  users/config: Add a warning to ignoreDelete (#608)
  users/versioning: Improve external versioning example script for Windows (#606)
  gui: Make terms bold in definition lists for better visibility (#609)
  dev/rest: Update db/browse example
  dev/release-creation: Create new milestone
  users/config: Use backslashes for Windows paths (#603)
  users/config: Improve modTimeWindowS explanation (#584)
  users/foldertypes: Button wording (#602)
  events: Add PendingDevicesChanged and PendingFoldersChanged (ref #592) (#597)
  users/config: Document decoupled database + config (fixes #571) (#600)
  users/stdiscosrv, users/strelaysrv: Better documentation how to obtain the binaries. (#601)
  advanced/folder-ignoredelete: Add a warning about using ignoreDelete (#598)
  rest: API for pending devices and folders. (#498)
  ...
@syncthing syncthing locked and limited conversation to collaborators Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants