Comments (4)
This may be all related to underlying assumptions of webmachine, and the flow chart that webmachine will go through.
Functionality such as if_none_match
and if_match
are included in the standard webmachine flow. However, that standard flow requires the stage G7 "Resource Exists" to be passed for both GET and POST. If we bypass the check for resource existence, we may well bypass inherent features for conditional handling of HTTP headers.
Some features that may have to be handled explicitly in the PB API, may be handled implicitly by webmachine.
from riak_kv.
The riak_kv_wm_object
module has to cover both GET, PUT and DELETE. Reviewing the code, there are some tricky issues for these flows.
On the GET path, one issue is that the content-type of an object returned, should be the content-type of the object which was used when it was PUT.
The natural place to fetch the resource in the webmachine flow is v3g7
- resource_exists/2
. However, this only occurs after validation, including validation of the encoding the client says it will accept. However, the inbound Accept-Encoding on the request cannot be validated until the object has been fetched (and we know what content-type it is to be presented back as).
To try and ensure this works there is an ensure_doc/2
functions that does the GET, only if there is not an object (i.e doc) already on the context. This ensure_doc/2
is then called in its natural place on resource_exists/2
, but also at any validation stage that may require knowledge of the content returned from the fetch. The ensure_doc/2
means the GET only occurs once, when ever information about the document is first needed.
Some of the exportable functions needed in validation such as encodings_provided
are also required as part of the PUT path (e.g. to return_body). these functions may be called either before or after resource_exists
on both GET and PUT. therefore we cannot simply ignore this when the method is PUT/POST.
from riak_kv.
For DELETE, the same initial path in webmachine applied as for GET. This means that DELETE will also try and GET the resource prior to calling riak_client:delete/4
or riak_client:delete_vclock/4
.
This means a further unnecessary GET, but also means that {error, notfound} is treated as a failure - whereby on the PB API {error, notfound} leads to a positive response, on the basis that the object is not there (even though it not being there is potentially unexpected).
from riak_kv.
Replacing with #1849.
This issue misunderstands the workings of webmachine. The problem is better explained in kv1849.
from riak_kv.
Related Issues (20)
- Equal not dominates and Merge
- Conditional PUTs - PB vs HTTP API HOT 2
- Handoff and Delete HOT 1
- Repository has no license HOT 1
- Replication reference with node_confirms HOT 1
- Reaper and eraser - overloading mailboxes
- benchmark tool for Riak KV HOT 23
- Pruned clocks and failure of full-sync replication HOT 2
- Two vnodes in the same preflist with the same vnode_id - amnesia chaos
- Dynamic changing of snk workers leads to unpredictable behaviour
- Deletion and full_sync
- Peer discovery and unavailable host
- Repare and Eraser do not distribute when using change_method = local
- Tictac AAE object_stats shows various statistics over a period of time. HOT 17
- Tidying Tictac Ecosystem for non-users HOT 2
- Porting Riak TS to OTP 26 (it applies to Riak KV also)
- Invalid JSON when trying to create a bucket type with custom properties HOT 6
- Interest in replacing Hyper HOT 3
- Riak_kv K8s memory consumption HOT 26
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riak_kv.