Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create a condition based action & confirm mechanism #42

Open
mrtrkmn opened this issue Jun 28, 2020 · 2 comments
Open

create a condition based action & confirm mechanism #42

mrtrkmn opened this issue Jun 28, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@mrtrkmn
Copy link
Member

mrtrkmn commented Jun 28, 2020

Now, it is known that cost calcualation is made through haaukins-store, which means that before accepting request from client there should be pre-check mechanism where webclient can either make a gRPC request to haaukins-store or haaukins itself to retrieve information about the cost in given time interval based on response, webclient should be able to proceed createEvent gRPC call. Example approach could be like

var  (
  
NotRecommendedWarning = errors.New("Have limited resources in chosen given range, might have problems, do you still wish to continue ?")
RiskWarning           = errors.New("Event can be started however it may effect other events, do you still wish to continue ? ")

)
// return values are string as message, and error to send warning if required 
func checkCondition(timeseries map[time.Time]int32) (string, error) {

      cost := timeseries[time.Format(timeLayout)]
      switch {

             case cost < 50:
			// create event without warning
             case cost > 90:
			// warning message // ask client to confirm the request 
             case cost <= 100 && cost > 90:
			// warning Too risky  // ask client to confirm the request

            default: 
                    // something could be added 
        }
} 

The provided PoC is go pseudo code however it can be done in javascript as well.

@mrtrkmn mrtrkmn changed the title create a condition based action create a condition based action & confirm mechanism Jun 28, 2020
@mrtrkmn mrtrkmn pinned this issue Jun 28, 2020
@mrtrkmn mrtrkmn added the enhancement New feature or request label Jun 28, 2020
@gianmarcomennecozzi
Copy link
Collaborator

lets the webclient send a request to haaukins to retrieve the cost in given time interval. We should add the rpc message to haaukins first and then develop it here

@mrtrkmn
Copy link
Member Author

mrtrkmn commented Jun 29, 2020

it is a little bit showing right ear with left hand, I can explain what I mean, when you wish to have a call. @gianmarcomennecozzi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants