Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(656)

Unified Diff: DB/API_REST/request.php

Issue 335100043: DB with histogram
Patch Set: DB Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DB/API_REST/print_cache.php ('k') | DB/API_REST/show_graph.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: DB/API_REST/request.php
diff --git a/DB/API_REST/request.php b/DB/API_REST/request.php
deleted file mode 100755
index d537556b273e3137dde513b356f68daba477dffb..0000000000000000000000000000000000000000
--- a/DB/API_REST/request.php
+++ /dev/null
@@ -1,103 +0,0 @@
-
-<?php
-
-include_once('mem_connect.php');
-
-$time = microtime(TRUE);
-
-if($_SERVER['REQUEST_METHOD'] == "POST"){
-
- //get data from post request
- $json_data = file_get_contents('php://input');
-// print_r($json_data);
- //echo $json_data;
- if (strcmp(json_decode($json_data,true)['module'], 'nfm') == 0) {
-
- if (isset((json_decode($json_data,true))['switches'][0]["port_counters"])) {
- $type=1;
- //echo "nfm: port_counters";
- }
-
- elseif (isset((json_decode($json_data,true))['switches'][0]["flow_counters"])) {
- $type=2;
- //echo "nfm: flow counters";
- }
-
- }
-
- elseif (strcmp(json_decode($json_data,true)['module'], 'hum') == 0) {
- $type=3;
- //echo "hum";
- }
- else if (strcmp(json_decode($json_data,true)['module'], 'rpm') == 0) {
- $type=4;
- //echo "rpm";
- }
- else {
- $type = 5;
- }
-// echo $type;
- $object_index = json_decode($json_data,true)['object_index'];
- $GLOBALS['index'] = $object_index;
- if($type == 5){
- $object_index = 0;
- }
- $setKey =$type .'|'. $object_index. '|'. md5($json_data .time ());
- //echo $setKey;
- $memcache->set($setKey,$json_data, time()+35);
-
-}
-
- if($_SERVER['REQUEST_METHOD'] == "GET"){
- $get_request = $_GET;
- $number_get=intval($get_request['row']);
- if(isset($get_request['table'])){
- if (strcmp($get_request['module'], 'nfm') == 0 ){
- if (strcmp($get_request['table'], 'port_counters') == 0 ) {
- $type_get = '1';
-
- }
- elseif (strcmp($get_request['table'], 'flow_counters')== 0 ) {
- $type_get = '2';
-
- }
- }
- }
-
- elseif (strcmp($get_request['module'], 'hum') == 0 ) {
- $type_get = '3';
- }
-
- else {
- $type_get = '4';
- }
-
- $keys = $memcache->getAllKeys();
-
- $keys_filtered = array_filter($keys, function ($v) {
- return substr($v, 0, 1) === $GLOBALS['type_get'];
- });
- rsort($keys_filtered);
- $last_index = explode('|', $keys_filtered[0])[1];
- $first_index = explode('|', end($keys_filtered))[1];
- foreach ($keys_filtered as $item) {
- $j_data = $memcache->get($item);
- $get_counter = 1;
- $current_index = $last_index;
- while ( $get_counter <= $number_get && $current_index >= $first_index ) {
-
- if(json_decode($j_data,true)['object_index'] == $current_index){
- print_r($j_data);
- }
-
- $current_index--;
- $get_counter++;
- }
-
- }
-
-}
-
-?>
-
-
« no previous file with comments | « DB/API_REST/print_cache.php ('k') | DB/API_REST/show_graph.php » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b