srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2013 Big Switch Networks, Inc. |
| 3 | # |
| 4 | # Licensed under the Eclipse Public License, Version 1.0 (the |
| 5 | # "License"); you may not use this file except in compliance with the |
| 6 | # License. You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.eclipse.org/legal/epl-v10.html |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. See the License for the specific language governing |
| 14 | # permissions and limitations under the License. |
| 15 | # |
| 16 | |
| 17 | from django.db import models |
Srikanth Vavilapalli | 669ba8a | 2014-10-16 11:41:19 -0700 | [diff] [blame] | 18 | """ |
srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 19 | # Create your models here. |
| 20 | class StatdropdConfig(models.Model): |
| 21 | |
| 22 | # id is set to the local cluster id. |
| 23 | id = models.CharField( |
| 24 | primary_key=True, |
| 25 | max_length=128) |
| 26 | |
| 27 | # Enable dropping local data |
| 28 | enabled = models.BooleanField( |
| 29 | verbose_name='Enabled', |
| 30 | help_text='Is dropping local data enabled.', |
| 31 | default=True) |
| 32 | |
| 33 | # Log level for the statdropd daemon process |
| 34 | log_level = models.CharField( |
| 35 | max_length=32, |
| 36 | verbose_name='Log Level', |
| 37 | help_text='Log level for the statdropd daemon process', |
| 38 | default='warning') |
| 39 | |
| 40 | period = models.PositiveIntegerField( |
| 41 | verbose_name='Period', |
| 42 | help_text='How often (in seconds) to drop local stats/log data', |
| 43 | default=600) |
| 44 | |
| 45 | #retain_synced_data_duration = models.PositiveIntegerField( |
| 46 | # verbose_name='Retain Synced Data', |
| 47 | # help_text="How long should data that's been synced to the cloud be retained locally", |
| 48 | # default=604800) |
| 49 | |
| 50 | retain_data_duration = models.PositiveIntegerField( |
| 51 | verbose_name='Retain Data Duration', |
| 52 | help_text="How long should data be retained locally", |
| 53 | default=604800) |
| 54 | |
| 55 | class Rest: |
| 56 | NAME = 'statdropd-config' |
| 57 | FIELD_INFO = ( |
| 58 | {'name': 'log_level', 'rest_name': 'log-level'}, |
| 59 | #{'name': 'retain_synced_data_duration', 'rest_name': 'retain-synced-data-duration'}, |
| 60 | {'name': 'retain_data_duration', 'rest_name': 'retain-data-duration'}, |
| 61 | ) |
| 62 | |
| 63 | class StatdropdProgressInfo(models.Model): |
| 64 | |
| 65 | # id value is <controller-node-id> |
| 66 | id = models.CharField( |
| 67 | primary_key=True, |
| 68 | max_length=256) |
| 69 | |
| 70 | last_drop_point = models.PositiveIntegerField( |
| 71 | verbose_name='Last Drop Point', |
| 72 | help_text='Last point when stats data was successfully dropped from the local controller node') |
| 73 | |
| 74 | class Rest: |
| 75 | NAME = 'statdropd-progress-info' |
| 76 | FIELD_INFO = ( |
| 77 | {'name': 'last_drop_point', 'rest_name': 'last-drop-point'}, |
| 78 | ) |
Srikanth Vavilapalli | 669ba8a | 2014-10-16 11:41:19 -0700 | [diff] [blame] | 79 | """ |