storage

package
v1.0.0-SNAPSHOT...-0150756 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * 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.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * 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.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * 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.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * 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.

* Copyright 2018 Johannes Donath <johannesd@torchmind.com> * and other copyright owners as documented in the project's IP log. * * 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncodedStorageBackend

type EncodedStorageBackend struct {
	// contains filtered or unexported fields
}

provides a storage backend which provides format agnostic storage of cache entries for all entry types

func (*EncodedStorageBackend) Close

func (f *EncodedStorageBackend) Close() error

func (*EncodedStorageBackend) GetBlacklist

func (f *EncodedStorageBackend) GetBlacklist() (*entity.Blacklist, error)

Server Data

func (*EncodedStorageBackend) GetNameHistory

func (f *EncodedStorageBackend) GetNameHistory(id uuid.UUID) (*entity.NameChangeHistory, error)

func (*EncodedStorageBackend) GetProfile

func (f *EncodedStorageBackend) GetProfile(id uuid.UUID) (*entity.Profile, error)

func (*EncodedStorageBackend) GetProfileId

func (f *EncodedStorageBackend) GetProfileId(name string, at time.Time) (*entity.ProfileId, error)

func (*EncodedStorageBackend) PurgeBlacklist

func (f *EncodedStorageBackend) PurgeBlacklist() error

func (*EncodedStorageBackend) PurgeNameHistory

func (f *EncodedStorageBackend) PurgeNameHistory(id uuid.UUID) error

func (*EncodedStorageBackend) PurgeProfile

func (f *EncodedStorageBackend) PurgeProfile(id uuid.UUID) error

func (*EncodedStorageBackend) PurgeProfileId

func (f *EncodedStorageBackend) PurgeProfileId(name string, at time.Time) error

func (*EncodedStorageBackend) PutBlacklist

func (f *EncodedStorageBackend) PutBlacklist(blacklist *entity.Blacklist) error

func (*EncodedStorageBackend) PutNameHistory

func (f *EncodedStorageBackend) PutNameHistory(id uuid.UUID, history *entity.NameChangeHistory) error

func (*EncodedStorageBackend) PutProfile

func (f *EncodedStorageBackend) PutProfile(profile *entity.Profile) error

func (*EncodedStorageBackend) PutProfileId

func (f *EncodedStorageBackend) PutProfileId(profileId *entity.ProfileId) error

type EncodedStorageBackendInterface

type EncodedStorageBackendInterface interface {
	// retrieves the data of a previously stored cache entry (given that it exists and is still
	// considered valid in accordance with its ttl)
	GetCacheEntry(category string, name string, ttl time.Duration) ([]byte, error)
	// creates or updates a cache entry
	PutCacheEntry(category string, name string, encoded []byte, ttl time.Duration) error
	// purges a cache entry (if it exists)
	PurgeCacheEntry(category string, name string) error

	// clears all allocated resources
	Close() error
}

type FileStorageBackendCfg

type FileStorageBackendCfg struct {
	Path string `hcl:"path,attr"`
}

type MemoryStorageBackend

type MemoryStorageBackend struct {
	// contains filtered or unexported fields
}

func (*MemoryStorageBackend) Close

func (m *MemoryStorageBackend) Close() error

func (*MemoryStorageBackend) GetBlacklist

func (m *MemoryStorageBackend) GetBlacklist() (*entity.Blacklist, error)

func (*MemoryStorageBackend) GetNameHistory

func (m *MemoryStorageBackend) GetNameHistory(id uuid.UUID) (*entity.NameChangeHistory, error)

func (*MemoryStorageBackend) GetProfile

func (m *MemoryStorageBackend) GetProfile(id uuid.UUID) (*entity.Profile, error)

func (*MemoryStorageBackend) GetProfileId

func (m *MemoryStorageBackend) GetProfileId(name string, at time.Time) (*entity.ProfileId, error)

func (*MemoryStorageBackend) PurgeBlacklist

func (m *MemoryStorageBackend) PurgeBlacklist() error

func (*MemoryStorageBackend) PurgeNameHistory

func (m *MemoryStorageBackend) PurgeNameHistory(id uuid.UUID) error

func (*MemoryStorageBackend) PurgeProfile

func (m *MemoryStorageBackend) PurgeProfile(id uuid.UUID) error

func (*MemoryStorageBackend) PurgeProfileId

func (m *MemoryStorageBackend) PurgeProfileId(name string, at time.Time) error

func (*MemoryStorageBackend) PutBlacklist

func (m *MemoryStorageBackend) PutBlacklist(blacklist *entity.Blacklist) error

func (*MemoryStorageBackend) PutNameHistory

func (m *MemoryStorageBackend) PutNameHistory(id uuid.UUID, history *entity.NameChangeHistory) error

func (*MemoryStorageBackend) PutProfile

func (m *MemoryStorageBackend) PutProfile(profile *entity.Profile) error

func (*MemoryStorageBackend) PutProfileId

func (m *MemoryStorageBackend) PutProfileId(profileId *entity.ProfileId) error

type StorageBackend

type StorageBackend interface {
	Close() error

	// Profile Data
	GetProfileId(name string, at time.Time) (*entity.ProfileId, error)
	PutProfileId(profileId *entity.ProfileId) error
	PurgeProfileId(name string, at time.Time) error
	GetNameHistory(id uuid.UUID) (*entity.NameChangeHistory, error)
	PutNameHistory(id uuid.UUID, history *entity.NameChangeHistory) error
	PurgeNameHistory(id uuid.UUID) error
	GetProfile(id uuid.UUID) (*entity.Profile, error)
	PutProfile(profile *entity.Profile) error
	PurgeProfile(id uuid.UUID) error

	// Server Data
	GetBlacklist() (*entity.Blacklist, error)
	PutBlacklist(blacklist *entity.Blacklist) error
	PurgeBlacklist() error
}

provides an abstraction layer between the application and a storage backend

func NewFileStorageBackend

func NewFileStorageBackend(cfg *server.Config) (StorageBackend, error)

creates a new file storage backend

func NewMemoryStorageBackend

func NewMemoryStorageBackend(cfg *server.Config) (StorageBackend, error)

creates a new memory based storage backend

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL