Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Shardingsphere ViewMetaDataPersistService Persist

From Leeroopedia


Knowledge Sources
Domains Persistence, Metadata
Last Updated 2026-02-10 00:00 GMT

Overview

Versioned persistence service for view metadata with load, persist, and drop operations.

Description

ViewMetaDataPersistService manages the persistence of SQL view metadata in the registry center with version management through VersionPersistService. It handles loading individual and batch views, persisting new or updated view definitions, and dropping view metadata.

Usage

Used by DatabaseMetaDataPersistFacade and SchemaMetaDataPersistService to manage view persistence during DDL operations.

Code Reference

Source Location

Signature

@RequiredArgsConstructor
public final class ViewMetaDataPersistService {

    private final PersistRepository repository;

    public Map<String, ShardingSphereView> load(String databaseName, String schemaName);
    public ShardingSphereView load(String databaseName, String schemaName, String viewName);
    public Collection<MetaDataVersion> persist(String databaseName, String schemaName,
        Map<String, ShardingSphereView> views);
    public void drop(String databaseName, String schemaName, String viewName);
}

Import

import org.apache.shardingsphere.mode.metadata.persist.metadata.service.ViewMetaDataPersistService;

I/O Contract

Inputs

Name Type Required Description
databaseName String Yes Target database
schemaName String Yes Target schema
views Map<String, ShardingSphereView> Varies View metadata to persist

Outputs

Name Type Description
load() returns Map<String, ShardingSphereView> All views in a schema
persist() returns Collection<MetaDataVersion> Version records for persisted views

Usage Examples

ViewMetaDataPersistService service = persistFacade.getViewMetaDataService();

// Load all views for a schema
Map<String, ShardingSphereView> views = service.load("my_db", "public");

// Persist updated views
Collection<MetaDataVersion> versions = service.persist("my_db", "public", updatedViews);

// Drop a view
service.drop("my_db", "public", "my_view");

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment