Documentation ¶
Overview ¶
Copyright 2022 The Dapr Authors 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 ¶
- func NewPostgreSQLStateStore(logger logger.Logger) state.Store
- type PostgreSQL
- func (p *PostgreSQL) BulkDelete(ctx context.Context, req []state.DeleteRequest) error
- func (p *PostgreSQL) BulkGet(ctx context.Context, req []state.GetRequest) (bool, []state.BulkGetResponse, error)
- func (p *PostgreSQL) BulkSet(ctx context.Context, req []state.SetRequest) error
- func (p *PostgreSQL) Close() error
- func (p *PostgreSQL) Delete(ctx context.Context, req *state.DeleteRequest) error
- func (p *PostgreSQL) Features() []state.Feature
- func (p *PostgreSQL) Get(ctx context.Context, req *state.GetRequest) (*state.GetResponse, error)
- func (p *PostgreSQL) GetComponentMetadata() map[string]string
- func (p *PostgreSQL) GetDBAccess() dbAccess
- func (p *PostgreSQL) Init(metadata state.Metadata) error
- func (p *PostgreSQL) Multi(ctx context.Context, request *state.TransactionalStateRequest) error
- func (p *PostgreSQL) Query(ctx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
- func (p *PostgreSQL) Set(ctx context.Context, req *state.SetRequest) error
- type PostgresDBAccess
- func (p *PostgresDBAccess) BulkDelete(parentCtx context.Context, req []state.DeleteRequest) error
- func (p *PostgresDBAccess) BulkSet(parentCtx context.Context, req []state.SetRequest) error
- func (p *PostgresDBAccess) CleanupExpired(ctx context.Context) error
- func (p *PostgresDBAccess) Close() error
- func (p *PostgresDBAccess) Delete(ctx context.Context, req *state.DeleteRequest) (err error)
- func (p *PostgresDBAccess) ExecuteMulti(parentCtx context.Context, request *state.TransactionalStateRequest) error
- func (p *PostgresDBAccess) Get(parentCtx context.Context, req *state.GetRequest) (*state.GetResponse, error)
- func (p *PostgresDBAccess) GetCleanupInterval() *time.Duration
- func (p *PostgresDBAccess) GetDB() *pgxpool.Pool
- func (p *PostgresDBAccess) Init(meta state.Metadata) error
- func (p *PostgresDBAccess) Query(parentCtx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
- func (p *PostgresDBAccess) ScheduleCleanupExpiredData(ctx context.Context)
- func (p *PostgresDBAccess) Set(ctx context.Context, req *state.SetRequest) error
- func (p *PostgresDBAccess) UpdateLastCleanup(ctx context.Context, db dbquerier, cleanupInterval time.Duration) (bool, error)
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PostgreSQL ¶
type PostgreSQL struct {
// contains filtered or unexported fields
}
PostgreSQL state store.
func (*PostgreSQL) BulkDelete ¶
func (p *PostgreSQL) BulkDelete(ctx context.Context, req []state.DeleteRequest) error
BulkDelete removes multiple entries from the store.
func (*PostgreSQL) BulkGet ¶ added in v1.0.0
func (p *PostgreSQL) BulkGet(ctx context.Context, req []state.GetRequest) (bool, []state.BulkGetResponse, error)
BulkGet performs a bulks get operations.
func (*PostgreSQL) BulkSet ¶
func (p *PostgreSQL) BulkSet(ctx context.Context, req []state.SetRequest) error
BulkSet adds/updates multiple entities on store.
func (*PostgreSQL) Delete ¶
func (p *PostgreSQL) Delete(ctx context.Context, req *state.DeleteRequest) error
Delete removes an entity from the store.
func (*PostgreSQL) Features ¶ added in v1.1.1
func (p *PostgreSQL) Features() []state.Feature
Features returns the features available in this state store.
func (*PostgreSQL) Get ¶
func (p *PostgreSQL) Get(ctx context.Context, req *state.GetRequest) (*state.GetResponse, error)
Get returns an entity from store.
func (*PostgreSQL) GetComponentMetadata ¶ added in v1.10.1
func (p *PostgreSQL) GetComponentMetadata() map[string]string
func (*PostgreSQL) GetDBAccess ¶ added in v1.10.1
func (p *PostgreSQL) GetDBAccess() dbAccess
Returns the dbaccess property. This method is used in tests.
func (*PostgreSQL) Init ¶
func (p *PostgreSQL) Init(metadata state.Metadata) error
Init initializes the SQL server state store.
func (*PostgreSQL) Multi ¶
func (p *PostgreSQL) Multi(ctx context.Context, request *state.TransactionalStateRequest) error
Multi handles multiple transactions. Implements TransactionalStore.
func (*PostgreSQL) Query ¶ added in v1.7.0
func (p *PostgreSQL) Query(ctx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
Query executes a query against store.
func (*PostgreSQL) Set ¶
func (p *PostgreSQL) Set(ctx context.Context, req *state.SetRequest) error
Set adds/updates an entity on store.
type PostgresDBAccess ¶ added in v1.10.1
type PostgresDBAccess struct {
// contains filtered or unexported fields
}
PostgresDBAccess implements dbaccess.
func (*PostgresDBAccess) BulkDelete ¶ added in v1.10.1
func (p *PostgresDBAccess) BulkDelete(parentCtx context.Context, req []state.DeleteRequest) error
func (*PostgresDBAccess) BulkSet ¶ added in v1.10.1
func (p *PostgresDBAccess) BulkSet(parentCtx context.Context, req []state.SetRequest) error
func (*PostgresDBAccess) CleanupExpired ¶ added in v1.10.1
func (p *PostgresDBAccess) CleanupExpired(ctx context.Context) error
func (*PostgresDBAccess) Close ¶ added in v1.10.1
func (p *PostgresDBAccess) Close() error
Close implements io.Close.
func (*PostgresDBAccess) Delete ¶ added in v1.10.1
func (p *PostgresDBAccess) Delete(ctx context.Context, req *state.DeleteRequest) (err error)
Delete removes an item from the state store.
func (*PostgresDBAccess) ExecuteMulti ¶ added in v1.10.1
func (p *PostgresDBAccess) ExecuteMulti(parentCtx context.Context, request *state.TransactionalStateRequest) error
func (*PostgresDBAccess) Get ¶ added in v1.10.1
func (p *PostgresDBAccess) Get(parentCtx context.Context, req *state.GetRequest) (*state.GetResponse, error)
Get returns data from the database. If data does not exist for the key an empty state.GetResponse will be returned.
func (*PostgresDBAccess) GetCleanupInterval ¶ added in v1.10.1
func (p *PostgresDBAccess) GetCleanupInterval() *time.Duration
GetCleanupInterval returns the cleanupInterval property. This is primarily used for tests.
func (*PostgresDBAccess) GetDB ¶ added in v1.10.1
func (p *PostgresDBAccess) GetDB() *pgxpool.Pool
func (*PostgresDBAccess) Init ¶ added in v1.10.1
func (p *PostgresDBAccess) Init(meta state.Metadata) error
Init sets up Postgres connection and ensures that the state table exists.
func (*PostgresDBAccess) Query ¶ added in v1.10.1
func (p *PostgresDBAccess) Query(parentCtx context.Context, req *state.QueryRequest) (*state.QueryResponse, error)
Query executes a query against store.
func (*PostgresDBAccess) ScheduleCleanupExpiredData ¶ added in v1.10.1
func (p *PostgresDBAccess) ScheduleCleanupExpiredData(ctx context.Context)
func (*PostgresDBAccess) Set ¶ added in v1.10.1
func (p *PostgresDBAccess) Set(ctx context.Context, req *state.SetRequest) error
Set makes an insert or update to the database.
func (*PostgresDBAccess) UpdateLastCleanup ¶ added in v1.10.1
func (p *PostgresDBAccess) UpdateLastCleanup(ctx context.Context, db dbquerier, cleanupInterval time.Duration) (bool, error)
UpdateLastCleanup sets the 'last-cleanup' value only if it's less than cleanupInterval. Returns true if the row was updated, which means that the cleanup can proceed.