Categorygithub.com/clevalle/CSE138_Assignment3
modulepackage
0.0.0-20211201063317-e4b84d7c168a
Repository: https://github.com/clevalle/cse138_assignment3.git
Documentation: pkg.go.dev

# README

Project Contributors: Conner LeValley ([email protected]) Dennis Pang ([email protected])

Team Contributions: Conner:

  • HandleKey (together)
  • HandleView
  • HandleGetKVS
  • HandleGetVC
  • BroadcastMessage(together)
  • isDataBaseChanged
  • didIDie

Dennis:

  • HandleKey (together)
  • HandleDown
  • BroadcastMessage(together)
  • containsVal
  • removeVal
  • getReplicaKVS
  • getReplicaVectorClock
  • pushIPtoReplicas

Acknowledgements: Patrick Redmond -- for helping our team quickly regarding the two questions we posted on Zulip. Zulip -- an immensely useful resource for questions regarding this assignment.

Citations:

  1. https://stackoverflow.com/questions/15323767/does-go-have-if-x-in-construct-similar-to-python We used this resource for help regarding finding a particular value in an array in golang. This also helped introduce the possibility of using this function in booleans as well, as we could return either a valid index if it is found, or a -1 if it is not found. It was useful when we were trying to find particukar elements in the arrays we created, such as the replicaArray.

  2. https://stackoverflow.com/questions/37334119/how-to-delete-an-element-from-a-slice-in-golang We used this citation to find a way to delete an element from an array in golang, as well as accouting for any index change. This was useful when we were attempting to modify the replica array in order to account for the view (wherein replicas can be deleted from the view).

  3. https://dev.to/uris77/go-notes-omitting-empty-structs-19d7 This article was useful to us as it taught us how to use nested structs, as well as just what we could do with structs in golang. This was vastly helpful in aiding us in our understanding of the causal metadata, and how could pass information through requests to replicas.

  4. https://pkg.go.dev/net/http We used the official golang documentation to figure out how to create a new http request. This request would then be forwarded to another instance, for which we must then grab the response and output appropriately.

  5. https://www.socketloop.com/references/golang-net-dialtimeout-function-example We used this article in trying to figure out a way to check if a response from an IP would be a timeout. This helped a lot when we were trying to figure out a way to determine whether or not a replica is down, so that we can update our view appropriately.

  6. https://stackoverflow.com/questions/43325288/golang-convert-interface-to-struct/43325450 Used this article to see how structs unpackage the informnation they were given by referencing the json value given to them after the variable declaration in the struct itself

  7. https://golang.org/src/net/http/status.go Golang status code reference page

Mechanism Description: Describe how your system detects when a replica goes down: Our system can detect when a replica is down when we broadcast messages (and we only broadcast messages that we receive from the client that also change our database i.e. we don't broadcast GETs). It detects a down replica when it first pings that replica whilst waiting for a timeout -- if the ping times out within 1 second, then we consider the replica down. After this step we then update the views of all other replicas to reflect this.

Describe how your system tracks causal dependencies: Our system is very similar to CBCAST Vector Clocks (from Zulip -- Patrick Redmond), wherein vector clocks increment at the sender index on Sends. In order to detect violations, we first check if the metadata is nil, if it isnt, then we check if the metadata is from the client. If it is, we make sure that the request vector is <= the local vector at all indexes or else there's a consistency violation. If the metadata is from a replica, then we make sure the vector clock's value at the senders index is 1 greater than the local vector's and <= at all other indexes or else there is another violation.

# Structs

reqMetaData is used to unpack request vals when they actually exist and are not null so they can be easily assigned a type.
declaring our Vector Clock, which we'll use for causal consistency.