blob: ddf3fd58e97880a271c5052d5423eb2178dc0ce9 [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "attestation/server/enrollment_queue.h"
#include <memory>
#include <utility>
namespace attestation {
EnrollmentQueue::EnrollmentQueue(size_t size_limit) : size_limit_(size_limit) {}
bool EnrollmentQueue::Push(const std::shared_ptr<AttestationFlowData>& data) {
DCHECK_LE(data->aca_type(), ACAType_ARRAYSIZE);
if (entries_[data->aca_type()].size() >= size_limit_) {
return false;
return true;
std::vector<std::shared_ptr<AttestationFlowData>> EnrollmentQueue::PopAll(
ACAType aca_type) {
auto result = std::move(entries_[aca_type]);
return result;
} // namespace attestation