Questions tagged [idempotent]

A function is said to be idempotent when it can be called multiple times without changing the result.

Idempotence is a property of certain function in mathematics or computer science. It states that the function can be applied multiple times without changing the result from the result of applying the function a single time.

Examples from mathematics

  • Multiplying some value by 1, or by 0; these should give the same result no matter how many times they are applied. I.e.:

    (x * 1) == (1 * (1 * x)) == (1 * (1 * (1 * x))) == ...

  • abs(x):

    abs(-3) == 3, but abs(3) == 3 too. Similarly abs(abs(-3)) == abs(abs(abs(-3))) ...

Examples from computer sience

  • HTTP-context: A GET-operation or a DELETE-operation; each of these should effect the same results each time. A counter-example could be a post-operation, which may result in a different outcome / state each time it is called (calling it multiple times may result in duplicate date being stored, for instance).
  • Setting a (boolean) flag; the resulting state should be the same whether you set it once or many times.
272 questions
0
votes
2 answers

when to use GET vs PUT, and what should happen if a PUT URI is typed in?

(This is not really specific to Rails, but I'll use Rails constructs to ask the question). TL;DR What should happen when a user types a URI into the address bar that really is a PUT operation and not a GET? Details Let's assume we have a web-enabled…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217
0
votes
1 answer

Should idempotent service respond with error after first call?

I'm writing service layer for DDD app. Services are exposed through JSON-RPC over WSS. I'm not sure how to respond to redundant calls to service. Some facts about the system: All requests must be completed within specific time or timeout exception…
0
votes
2 answers

Idempotent client-retryable entry creation in AppEngine given eventually consistent queries, etc

I need to come up with a strategy for handling client-retries on a data-store entry creation: Client sends request to create new entry in database Server performs entry creation and prepares success-reply Some error happens that makes the client…
Markus A.
  • 12,349
  • 8
  • 52
  • 116
0
votes
2 answers

How can I perform an idempotent insert row using subsonic with a SQL 2008 backend?

How can I perform an idempotent insert row using subsonic with a SQL 2008 backend? e.g. I have a table "Colors" where name is the primary key. Color c = new Color; c.name = "red"; c.Save; Color c2 = new Color; c2.name = "red"; c2.Save; // throws…
Jason Hernandez
  • 2,907
  • 1
  • 19
  • 30
0
votes
1 answer

Can someone give me a better definition of a idempotent http method?

idempotent means performing an operation N times yields the same results http://restcookbook.com/HTTP%20Methods/idempotency/ the author mentions "this only applies to the result, not the resource itself". What is the difference between the result…
HukeLau_DABA
  • 2,384
  • 6
  • 33
  • 51
0
votes
2 answers

Copy-Item no target directory

Say you have this folder foo You can run this command in Bash cp -r --no-target-directory foo bar and it will create foo bar # same contents as foo Then you can re-run the command without changing the result. How can you do this with PowerShell?
Zombo
  • 1
  • 62
  • 391
  • 407
0
votes
2 answers

Basic Sidekiq Questions about Idempotency and functions

I'm using Sidekiq to perform some heavy processing in the background. I looked online but couldn't find the answers to the following questions. I am using: Class.delay.use_method(listing_id) And then, inside the class, I have a…
Delos Chang
  • 1,823
  • 3
  • 27
  • 47
0
votes
2 answers

Multiple Instances of Azure Worker Roles for non-transaction integration tasks

We have an upcoming project where we'll need to integrate with 3rd parties over a variety of transports to get data from them. Things like WCF Endpoints & Web API Rest Endpoints are fine. However in 2 scenario's we'll need to either pick up…
Eoin Campbell
  • 43,500
  • 17
  • 101
  • 157
0
votes
1 answer

Non idempotent SQL command with OrientDB JDBC Driver

Hello, I'm facing an issue while using the JDBC driver to connect to a Plocal Orient DB. Here is my code: Properties info = new Properties(); info.put("user", this.user); info.put("password", this.pwd); …
khaldoune
  • 121
  • 1
  • 2
  • 10
0
votes
1 answer

Getting error when using post method in form

I am getting null when I am using post method while passing a form to the next page A repeat of this question link text Title