<commit_before>// Copyright (c) 2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package quotas

import (
	"github.com/01org/ciao/ciao-controller/types"
	"github.com/01org/ciao/payloads"
)

type quota struct {
	limit    int
	consumed int
}

type tenantData struct {
	quotas map[payloads.Resource]*quota

	perInstanceVCPUs  int
	perInstanceMemory int
	perVolumeSize     int
	perImageSize      int
}

// Quotas provides a quota and limit service
type Quotas struct {
	ch chan interface{}
}

// Result provides a method for querying the result of a Consume operation.
type Result interface {
	Allowed() bool
	Reason() string
	Resources() []payloads.RequestedResource
}

type consumeOp struct {
	tenantID  string
	resources []payloads.RequestedResource
	ch        chan Result
}

type releaseOp struct {
	tenantID  string
	resources []payloads.RequestedResource
}

type updateOp struct {
	tenantID string
	quotas   []types.QuotaDetails
	doneCh   chan struct{}
}

type dumpOp struct {
	tenantID string
	ch       chan []types.QuotaDetails
}

type result struct {
	allowed   bool
	reason    string
	resources []payloads.RequestedResource
	doneCh    chan struct{}
}

var supportedResources = [...]payloads.Resource{
	payloads.VCPUs,<commit_msg>quotas: Remove unused code<commit_after>// Copyright (c) 2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package quotas

import (
	"github.com/01org/ciao/ciao-controller/types"
	"github.com/01org/ciao/payloads"
)

type quota struct {
	limit    int
	consumed int
}

type tenantData struct {
	quotas map[payloads.Resource]*quota

	perInstanceVCPUs  int
	perInstanceMemory int
	perVolumeSize     int
}

// Quotas provides a quota and limit service
type Quotas struct {
	ch chan interface{}
}

// Result provides a method for querying the result of a Consume operation.
type Result interface {
	Allowed() bool
	Reason() string
	Resources() []payloads.RequestedResource
}

type consumeOp struct {
	tenantID  string
	resources []payloads.RequestedResource
	ch        chan Result
}

type releaseOp struct {
	tenantID  string
	resources []payloads.RequestedResource
}

type updateOp struct {
	tenantID string
	quotas   []types.QuotaDetails
	doneCh   chan struct{}
}

type dumpOp struct {
	tenantID string
	ch       chan []types.QuotaDetails
}

type result struct {
	allowed   bool
	reason    string
	resources []payloads.RequestedResource
}

var supportedResources = [...]payloads.Resource{
	payloads.VCPUs,
{'fraction_non_alphanumeric': 0.07850413930916357, 'fraction_numerical': 0.006851270339708821, 'mean_word_length': 3.6907630522088355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '239206', 'n_tokens_mistral': 1034, 'n_tokens_neox': 1014, 'n_words': 385}