// WriteMetaProperty persists a key-value pair to the meta store.
// If the store cannot be loaded, the write will fail and an error
// will be logged.
WriteMetaProperty persists a key-value pair to the meta store.
If the store cannot be loaded, the write will fail and an error
will be logged.
// WriteMetaProperty persists a key - value pair to the meta store . // If the store cannot be loaded the write will fail and an error // will be logged .
func WriteMetaProperty(key string, value interface{}) error {
	state, err := loadState()
	if err != nil {
		return fmt.Errorf("failed to read existing metadata: %s", err)
	}
	state[key] = value
	j, err := json.Marshal(state)
	if err != nil {
		return fmt.Errorf("failed to marshall metadata: %s", err)
	}
	metaFile, err := ensureMetaFile()
	if err != nil {
		return fmt.Errorf("failed to get metadata file: %s", err)
	}
	err = os.WriteFile(metaFile, j, 0644)
	if err != nil {
		return fmt.Errorf("failed to write metadata file: %s", err)
	}
	return nil
}
func WriteMetaProperty ( key string , value interface { } ) error { state , err := loadState ( ) if err != nil { return fmt . Errorf ( " " , err ) } state [ key ] = value j , err := json . Marshal ( state ) if err != nil { return fmt . Errorf ( " " , err ) } metaFile , err := ensureMetaFile ( ) if err != nil { return fmt . Errorf ( " " , err ) } err = os . WriteFile ( metaFile , j , 0644 ) if err != nil { return fmt . Errorf ( " " , err ) } return nil }
WriteMetaProperty persists a key-value pair to the meta store.
WriteMetaProperty persists a key - value pair to the meta store .